Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 36 additions & 10 deletions sdk/java/mcp-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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));
Expand Down