@@ -487,16 +487,16 @@ void testJsonSchema() throws Exception {
487487 """ ;
488488
489489 // 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 );
491491
492492 // Serialize the object back to a string
493- String serialized = mapper .writeValueAsString (schema );
493+ String serialized = mcpJacksonCodec . getMapper () .writeValueAsString (schema );
494494
495495 // Deserialize again
496- McpSchema .JsonSchema deserialized = mapper .readValue (serialized , McpSchema .JsonSchema .class );
496+ McpSchema .JsonSchema deserialized = mcpJacksonCodec . getMapper () .readValue (serialized , McpSchema .JsonSchema .class );
497497
498498 // Serialize one more time and compare with the first serialization
499- String serializedAgain = mapper .writeValueAsString (deserialized );
499+ String serializedAgain = mcpJacksonCodec . getMapper () .writeValueAsString (deserialized );
500500
501501 // The two serialized strings should be the same
502502 assertThatJson (serializedAgain ).when (Option .IGNORING_ARRAY_ORDER ).isEqualTo (json (serialized ));
@@ -530,16 +530,16 @@ void testJsonSchemaWithDefinitions() throws Exception {
530530 """ ;
531531
532532 // 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 );
534534
535535 // Serialize the object back to a string
536- String serialized = mapper .writeValueAsString (schema );
536+ String serialized = mcpJacksonCodec . getMapper () .writeValueAsString (schema );
537537
538538 // Deserialize again
539- McpSchema .JsonSchema deserialized = mapper .readValue (serialized , McpSchema .JsonSchema .class );
539+ McpSchema .JsonSchema deserialized = mcpJacksonCodec . getMapper () .readValue (serialized , McpSchema .JsonSchema .class );
540540
541541 // Serialize one more time and compare with the first serialization
542- String serializedAgain = mapper .writeValueAsString (deserialized );
542+ String serializedAgain = mcpJacksonCodec . getMapper () .writeValueAsString (deserialized );
543543
544544 // The two serialized strings should be the same
545545 assertThatJson (serializedAgain ).when (Option .IGNORING_ARRAY_ORDER ).isEqualTo (json (serialized ));
@@ -596,16 +596,17 @@ void testToolWithComplexSchema() throws Exception {
596596 }
597597 """ ;
598598
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 );
600601
601602 // Serialize the tool to a string
602- String serialized = mapper .writeValueAsString (tool );
603+ String serialized = mcpJacksonCodec . getMapper () .writeValueAsString (tool );
603604
604605 // 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 );
606607
607608 // Serialize again and compare with first serialization
608- String serializedAgain = mapper .writeValueAsString (deserializedTool );
609+ String serializedAgain = mcpJacksonCodec . getMapper () .writeValueAsString (deserializedTool );
609610
610611 // The two serialized strings should be the same
611612 assertThatJson (serializedAgain ).when (Option .IGNORING_ARRAY_ORDER ).isEqualTo (json (serialized ));
0 commit comments