Fix Java SDK documentation where it's incosistent to API (#154)
This commit is contained in:
parent
111d51d809
commit
b40820b1a4
1 changed files with 36 additions and 10 deletions
|
|
@ -259,12 +259,25 @@ Supported logging levels (in order of increasing severity): DEBUG (0), INFO (1),
|
||||||
<Tab title="Sync">
|
<Tab title="Sync">
|
||||||
```java
|
```java
|
||||||
// Sync tool registration
|
// 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(
|
var syncToolRegistration = new McpServerFeatures.SyncToolRegistration(
|
||||||
new Tool("calculator", "Basic calculator", Map.of(
|
new Tool("calculator", "Basic calculator", schema),
|
||||||
"operation", "string",
|
|
||||||
"a", "number",
|
|
||||||
"b", "number"
|
|
||||||
)),
|
|
||||||
arguments -> {
|
arguments -> {
|
||||||
// Tool implementation
|
// Tool implementation
|
||||||
return new CallToolResult(result, false);
|
return new CallToolResult(result, false);
|
||||||
|
|
@ -276,12 +289,25 @@ var syncToolRegistration = new McpServerFeatures.SyncToolRegistration(
|
||||||
<Tab title="Async">
|
<Tab title="Async">
|
||||||
```java
|
```java
|
||||||
// Async tool registration
|
// 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(
|
var asyncToolRegistration = new McpServerFeatures.AsyncToolRegistration(
|
||||||
new Tool("calculator", "Basic calculator", Map.of(
|
new Tool("calculator", "Basic calculator", schema),
|
||||||
"operation", "string",
|
|
||||||
"a", "number",
|
|
||||||
"b", "number"
|
|
||||||
)),
|
|
||||||
arguments -> {
|
arguments -> {
|
||||||
// Tool implementation
|
// Tool implementation
|
||||||
return Mono.just(new CallToolResult(result, false));
|
return Mono.just(new CallToolResult(result, false));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue