File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
src/ModelContextProtocol.Core/Protocol
tests/ModelContextProtocol.Tests/Protocol Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 11using System . Diagnostics . CodeAnalysis ;
2- using System . Text . Json ;
2+ using System . Text . Json . Nodes ;
33using System . Text . Json . Serialization ;
44
55namespace ModelContextProtocol . Protocol ;
@@ -35,5 +35,5 @@ public sealed class Root
3535 /// This is reserved by the protocol for future use.
3636 /// </remarks>
3737 [ JsonPropertyName ( "_meta" ) ]
38- public JsonElement ? Meta { get ; set ; }
38+ public JsonObject ? Meta { get ; set ; }
3939}
Original file line number Diff line number Diff line change 11using ModelContextProtocol . Protocol ;
22using System . Text . Json ;
3+ using System . Text . Json . Nodes ;
34
45namespace ModelContextProtocol . Tests . Protocol ;
56
@@ -12,7 +13,7 @@ public static void Root_SerializationRoundTrip_PreservesAllProperties()
1213 {
1314 Uri = "file:///home/user/project" ,
1415 Name = "My Project" ,
15- Meta = JsonDocument . Parse ( """{ "custom": "data"}""" ) . RootElement . Clone ( )
16+ Meta = new JsonObject { [ "custom" ] = "data" }
1617 } ;
1718
1819 string json = JsonSerializer . Serialize ( original , McpJsonUtilities . DefaultOptions ) ;
@@ -22,7 +23,7 @@ public static void Root_SerializationRoundTrip_PreservesAllProperties()
2223 Assert . Equal ( "file:///home/user/project" , deserialized . Uri ) ;
2324 Assert . Equal ( "My Project" , deserialized . Name ) ;
2425 Assert . NotNull ( deserialized . Meta ) ;
25- Assert . Equal ( "data" , deserialized . Meta . Value . GetProperty ( "custom" ) . GetString ( ) ) ;
26+ Assert . Equal ( "data" , ( string ? ) deserialized . Meta [ "custom" ] ) ;
2627 }
2728
2829 [ Fact ]
You can’t perform that action at this time.
0 commit comments