Package io.modelcontextprotocol.server
Class McpServerFeatures.SyncToolSpecification.Builder
java.lang.Object
io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification.Builder
- Enclosing class:
- McpServerFeatures.SyncToolSpecification
Builder for creating SyncToolSpecification instances.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the SyncToolSpecification instance.callHandler(BiFunction<McpSyncServerExchange, McpSchema.CallToolRequest, McpSchema.CallToolResult> callHandler) Sets the call tool handler function.tool(McpSchema.Tool tool) Sets the tool definition.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
tool
Sets the tool definition.- Parameters:
tool- The tool definition including name, description, and parameter schema- Returns:
- this builder instance
-
callHandler
public McpServerFeatures.SyncToolSpecification.Builder callHandler(BiFunction<McpSyncServerExchange, McpSchema.CallToolRequest, McpSchema.CallToolResult> callHandler) Sets the call tool handler function.- Parameters:
callHandler- The function that implements the tool's logic- Returns:
- this builder instance
-
build
Builds the SyncToolSpecification instance.- Returns:
- a new SyncToolSpecification instance
- Throws:
IllegalArgumentException- if required fields are not set
-