@@ -487,16 +487,16 @@ void testJsonSchema() throws Exception {
487
487
""" ;
488
488
489
489
// Deserialize the original string to a JsonSchema object
490
- McpSchema .JsonSchema schema = mapper .readValue (schemaJson , McpSchema .JsonSchema .class );
490
+ McpSchema .JsonSchema schema = mcpJacksonCodec . getMapper () .readValue (schemaJson , McpSchema .JsonSchema .class );
491
491
492
492
// Serialize the object back to a string
493
- String serialized = mapper .writeValueAsString (schema );
493
+ String serialized = mcpJacksonCodec . getMapper () .writeValueAsString (schema );
494
494
495
495
// Deserialize again
496
- McpSchema .JsonSchema deserialized = mapper .readValue (serialized , McpSchema .JsonSchema .class );
496
+ McpSchema .JsonSchema deserialized = mcpJacksonCodec . getMapper () .readValue (serialized , McpSchema .JsonSchema .class );
497
497
498
498
// Serialize one more time and compare with the first serialization
499
- String serializedAgain = mapper .writeValueAsString (deserialized );
499
+ String serializedAgain = mcpJacksonCodec . getMapper () .writeValueAsString (deserialized );
500
500
501
501
// The two serialized strings should be the same
502
502
assertThatJson (serializedAgain ).when (Option .IGNORING_ARRAY_ORDER ).isEqualTo (json (serialized ));
@@ -530,16 +530,16 @@ void testJsonSchemaWithDefinitions() throws Exception {
530
530
""" ;
531
531
532
532
// Deserialize the original string to a JsonSchema object
533
- McpSchema .JsonSchema schema = mapper .readValue (schemaJson , McpSchema .JsonSchema .class );
533
+ McpSchema .JsonSchema schema = mcpJacksonCodec . getMapper () .readValue (schemaJson , McpSchema .JsonSchema .class );
534
534
535
535
// Serialize the object back to a string
536
- String serialized = mapper .writeValueAsString (schema );
536
+ String serialized = mcpJacksonCodec . getMapper () .writeValueAsString (schema );
537
537
538
538
// Deserialize again
539
- McpSchema .JsonSchema deserialized = mapper .readValue (serialized , McpSchema .JsonSchema .class );
539
+ McpSchema .JsonSchema deserialized = mcpJacksonCodec . getMapper () .readValue (serialized , McpSchema .JsonSchema .class );
540
540
541
541
// Serialize one more time and compare with the first serialization
542
- String serializedAgain = mapper .writeValueAsString (deserialized );
542
+ String serializedAgain = mcpJacksonCodec . getMapper () .writeValueAsString (deserialized );
543
543
544
544
// The two serialized strings should be the same
545
545
assertThatJson (serializedAgain ).when (Option .IGNORING_ARRAY_ORDER ).isEqualTo (json (serialized ));
@@ -596,16 +596,17 @@ void testToolWithComplexSchema() throws Exception {
596
596
}
597
597
""" ;
598
598
599
- McpSchema .Tool tool = new McpSchema .Tool ("addressTool" , "Handles addresses" , complexSchemaJson );
599
+ McpSchema .JsonSchema schema = mcpJacksonCodec .getMapper ().readValue (complexSchemaJson , McpSchema .JsonSchema .class );
600
+ McpSchema .Tool tool = new McpSchema .Tool ("addressTool" , "Handles addresses" , schema );
600
601
601
602
// Serialize the tool to a string
602
- String serialized = mapper .writeValueAsString (tool );
603
+ String serialized = mcpJacksonCodec . getMapper () .writeValueAsString (tool );
603
604
604
605
// Deserialize back to a Tool object
605
- McpSchema .Tool deserializedTool = mapper .readValue (serialized , McpSchema .Tool .class );
606
+ McpSchema .Tool deserializedTool = mcpJacksonCodec . getMapper () .readValue (serialized , McpSchema .Tool .class );
606
607
607
608
// Serialize again and compare with first serialization
608
- String serializedAgain = mapper .writeValueAsString (deserializedTool );
609
+ String serializedAgain = mcpJacksonCodec . getMapper () .writeValueAsString (deserializedTool );
609
610
610
611
// The two serialized strings should be the same
611
612
assertThatJson (serializedAgain ).when (Option .IGNORING_ARRAY_ORDER ).isEqualTo (json (serialized ));
0 commit comments