From b40820b1a489f5a4bfad440460c53f1bda228819 Mon Sep 17 00:00:00 2001 From: Dennis Kawurek Date: Mon, 10 Mar 2025 13:12:21 +0100 Subject: [PATCH] Fix Java SDK documentation where it's incosistent to API (#154) --- 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));