Fix Java SDK documentation where it's incosistent to API (#154)

This commit is contained in:
Dennis Kawurek 2025-03-10 13:12:21 +01:00 • committed by GitHub
commit b40820b1a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -259,12 +259,25 @@ Supported logging levels (in order of increasing severity): DEBUG (0), INFO (1),
<Tab title="Sync">
```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(
<Tab title="Async">
```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));