File tree Expand file tree Collapse file tree
src/ModelContextProtocol.Core/Server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -540,7 +540,7 @@ typeProperty.ValueKind is not JsonValueKind.String ||
540540 JsonElement ? elementResult = aiFunctionResult switch
541541 {
542542 JsonElement jsonElement => jsonElement ,
543- JsonNode node => node . Deserialize ( McpJsonUtilities . JsonContext . Default . JsonElement ) ,
543+ JsonNode node => JsonSerializer . SerializeToElement ( node , McpJsonUtilities . JsonContext . Default . JsonNode ) ,
544544 null => null ,
545545 _ => JsonSerializer . SerializeToElement ( aiFunctionResult , AIFunction . JsonSerializerOptions . GetTypeInfo ( typeof ( object ) ) ) ,
546546 } ;
@@ -550,10 +550,10 @@ typeProperty.ValueKind is not JsonValueKind.String ||
550550 JsonNode ? resultNode = elementResult is { } je
551551 ? JsonSerializer . SerializeToNode ( je , McpJsonUtilities . JsonContext . Default . JsonElement )
552552 : null ;
553- return new JsonObject
553+ return JsonSerializer . SerializeToElement ( new JsonObject
554554 {
555555 [ "result" ] = resultNode
556- } . Deserialize ( McpJsonUtilities . JsonContext . Default . JsonElement ) ;
556+ } , McpJsonUtilities . JsonContext . Default . JsonObject ) ;
557557 }
558558
559559 return elementResult ;
You can’t perform that action at this time.
0 commit comments