Package io.modelcontextprotocol.server
Class McpServerFeatures.AsyncToolSpecification.Builder
java.lang.Object
io.modelcontextprotocol.server.McpServerFeatures.AsyncToolSpecification.Builder
- Enclosing class:
- McpServerFeatures.AsyncToolSpecification
Builder for creating AsyncToolSpecification instances.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the AsyncToolSpecification instance.callHandler(BiFunction<McpAsyncServerExchange, McpSchema.CallToolRequest, reactor.core.publisher.Mono<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.AsyncToolSpecification.Builder callHandler(BiFunction<McpAsyncServerExchange, McpSchema.CallToolRequest, reactor.core.publisher.Mono<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 AsyncToolSpecification instance.- Returns:
- a new AsyncToolSpecification instance
- Throws:
IllegalArgumentException- if required fields are not set
-