public static class McpServerFeatures.SyncToolSpecification extends Object
Example tool specification:
McpServerFeatures.SyncToolSpecification.builder()
.tool(new Tool(
"calculator",
"Performs mathematical calculations",
new JsonSchemaObject()
.required("expression")
.property("expression", JsonSchemaType.STRING)))
.toolHandler((exchange, req) -> {
String expr = (String) req.arguments().get("expression");
return new CallToolResult("Result: " + evaluate(expr));
}))
.build();
McpSyncServerExchange upon which the server can interact with the connected
McpSyncServerExchange and a
McpSchema.CallToolRequest and returning
results. The function's first argument is an McpSyncServerExchange upon
which the server can interact with the client. The second arguments is a map of
arguments passed to the tool.| Modifier and Type | Class and Description |
|---|---|
static class |
McpServerFeatures.SyncToolSpecification.Builder
Builder for creating SyncToolSpecification instances.
|
| Constructor and Description |
|---|
SyncToolSpecification(McpSchema.Tool tool,
BiFunction<McpSyncServerExchange,Map<String,Object>,McpSchema.CallToolResult> call)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
static McpServerFeatures.SyncToolSpecification.Builder |
builder()
Creates a new builder instance.
|
@Deprecated public SyncToolSpecification(McpSchema.Tool tool, BiFunction<McpSyncServerExchange,Map<String,Object>,McpSchema.CallToolResult> call)
public static McpServerFeatures.SyncToolSpecification.Builder builder()
Copyright © 2025. All rights reserved.