From 3999a50e749a303fd2e49931946c96e156bfb99f Mon Sep 17 00:00:00 2001 From: Dennis Kawurek Date: Sat, 22 Feb 2025 16:30:00 +0100 Subject: [PATCH] Fix Java SDK documentation where it's incosistent to API --- sdk/java/mcp-server.mdx | 46 ++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/sdk/java/mcp-server.mdx b/sdk/java/mcp-server.mdx index 4cb05ad..d7047f9 100644 --- a/sdk/java/mcp-server.mdx +++ b/sdk/java/mcp-server.mdx @@ -259,12 +259,25 @@ Supported logging levels (in order of increasing severity): DEBUG (0), INFO (1), ```java // Sync tool registration +var schema = """ + { + "type" : "object", + "id" : "urn:jsonschema:Operation", + "properties" : { + "operation" : { + "type" : "string" + }, + "a" : { + "type" : "number" + }, + "b" : { + "type" : "number" + } + } + } + """; var syncToolRegistration = new McpServerFeatures.SyncToolRegistration( - new Tool("calculator", "Basic calculator", Map.of( - "operation", "string", - "a", "number", - "b", "number" - )), + new Tool("calculator", "Basic calculator", schema), arguments -> { // Tool implementation return new CallToolResult(result, false); @@ -276,12 +289,25 @@ var syncToolRegistration = new McpServerFeatures.SyncToolRegistration( ```java // Async tool registration +var schema = """ + { + "type" : "object", + "id" : "urn:jsonschema:Operation", + "properties" : { + "operation" : { + "type" : "string" + }, + "a" : { + "type" : "number" + }, + "b" : { + "type" : "number" + } + } + } + """; var asyncToolRegistration = new McpServerFeatures.AsyncToolRegistration( - new Tool("calculator", "Basic calculator", Map.of( - "operation", "string", - "a", "number", - "b", "number" - )), + new Tool("calculator", "Basic calculator", schema), arguments -> { // Tool implementation return Mono.just(new CallToolResult(result, false));