public static class McpServerFeatures.SyncToolSpecification
extends java.lang.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.限定符和类型 | 类和说明 |
---|---|
static class |
McpServerFeatures.SyncToolSpecification.Builder
Builder for creating SyncToolSpecification instances.
|
构造器和说明 |
---|
SyncToolSpecification(McpSchema.Tool tool,
java.util.function.BiFunction<McpSyncServerExchange,java.util.Map<java.lang.String,java.lang.Object>,McpSchema.CallToolResult> call)
已过时。
|
限定符和类型 | 方法和说明 |
---|---|
static McpServerFeatures.SyncToolSpecification.Builder |
builder()
Creates a new builder instance.
|
@Deprecated public SyncToolSpecification(McpSchema.Tool tool, java.util.function.BiFunction<McpSyncServerExchange,java.util.Map<java.lang.String,java.lang.Object>,McpSchema.CallToolResult> call)
public static McpServerFeatures.SyncToolSpecification.Builder builder()