@@ -1307,7 +1307,9 @@ public ListToolsResult(List<Tool> tools, String nextCursor) {
13071307 * @param additionalProperties Whether additional properties are allowed
13081308 * @param defs Schema definitions using the newer $defs keyword
13091309 * @param definitions Schema definitions using the legacy definitions keyword
1310+ * @deprecated use {@link Map} instead.
13101311 */
1312+ @ Deprecated
13111313 @ JsonInclude (JsonInclude .Include .NON_ABSENT )
13121314 @ JsonIgnoreProperties (ignoreUnknown = true )
13131315 public record JsonSchema ( // @formatter:off
@@ -1363,7 +1365,7 @@ public record Tool( // @formatter:off
13631365 @ JsonProperty ("name" ) String name ,
13641366 @ JsonProperty ("title" ) String title ,
13651367 @ JsonProperty ("description" ) String description ,
1366- @ JsonProperty ("inputSchema" ) JsonSchema inputSchema ,
1368+ @ JsonProperty ("inputSchema" ) Map < String , Object > inputSchema ,
13671369 @ JsonProperty ("outputSchema" ) Map <String , Object > outputSchema ,
13681370 @ JsonProperty ("annotations" ) ToolAnnotations annotations ,
13691371 @ JsonProperty ("_meta" ) Map <String , Object > meta ) { // @formatter:on
@@ -1380,7 +1382,7 @@ public static class Builder {
13801382
13811383 private String description ;
13821384
1383- private JsonSchema inputSchema ;
1385+ private Map < String , Object > inputSchema ;
13841386
13851387 private Map <String , Object > outputSchema ;
13861388
@@ -1403,13 +1405,34 @@ public Builder description(String description) {
14031405 return this ;
14041406 }
14051407
1408+ /**
1409+ * @deprecated use {@link #inputSchema(Map)} instead.
1410+ */
1411+ @ Deprecated
14061412 public Builder inputSchema (JsonSchema inputSchema ) {
1413+ Map <String , Object > schema = new HashMap <>();
1414+ if (inputSchema .type () != null )
1415+ schema .put ("type" , inputSchema .type ());
1416+ if (inputSchema .properties () != null )
1417+ schema .put ("properties" , inputSchema .properties ());
1418+ if (inputSchema .required () != null )
1419+ schema .put ("required" , inputSchema .required ());
1420+ if (inputSchema .additionalProperties () != null )
1421+ schema .put ("additionalProperties" , inputSchema .additionalProperties ());
1422+ if (inputSchema .defs () != null )
1423+ schema .put ("$defs" , inputSchema .defs ());
1424+ if (inputSchema .definitions () != null )
1425+ schema .put ("definitions" , inputSchema .definitions ());
1426+ return inputSchema (schema );
1427+ }
1428+
1429+ public Builder inputSchema (Map <String , Object > inputSchema ) {
14071430 this .inputSchema = inputSchema ;
14081431 return this ;
14091432 }
14101433
14111434 public Builder inputSchema (McpJsonMapper jsonMapper , String inputSchema ) {
1412- this .inputSchema = parseSchema (jsonMapper , inputSchema );
1435+ this .inputSchema = schemaToMap (jsonMapper , inputSchema );
14131436 return this ;
14141437 }
14151438
@@ -1450,15 +1473,6 @@ private static Map<String, Object> schemaToMap(McpJsonMapper jsonMapper, String
14501473 }
14511474 }
14521475
1453- private static JsonSchema parseSchema (McpJsonMapper jsonMapper , String schema ) {
1454- try {
1455- return jsonMapper .readValue (schema , JsonSchema .class );
1456- }
1457- catch (IOException e ) {
1458- throw new IllegalArgumentException ("Invalid schema: " + schema , e );
1459- }
1460- }
1461-
14621476 /**
14631477 * Used by the client to call a tool provided by the server.
14641478 *
0 commit comments