Package org.springframework.ai.mcp
Class AsyncMcpToolCallback.Builder
java.lang.Object
org.springframework.ai.mcp.AsyncMcpToolCallback.Builder
- Enclosing class:
- AsyncMcpToolCallback
Builder for constructing AsyncMcpToolCallback instances.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds an AsyncMcpToolCallback with the configured parameters.mcpClient(io.modelcontextprotocol.client.McpAsyncClient mcpClient) Sets the MCP client for tool execution.prefixedToolName(String prefixedToolName) Sets the prefixed tool name for the tool definition.tool(io.modelcontextprotocol.spec.McpSchema.Tool tool) Sets the MCP tool to adapt.toolContextToMcpMetaConverter(ToolContextToMcpMetaConverter toolContextToMcpMetaConverter) Sets the converter for tool context to MCP metadata transformation.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
mcpClient
public AsyncMcpToolCallback.Builder mcpClient(io.modelcontextprotocol.client.McpAsyncClient mcpClient) Sets the MCP client for tool execution.- Parameters:
mcpClient- the MCP client (required)- Returns:
- this builder
-
tool
Sets the MCP tool to adapt.- Parameters:
tool- the MCP tool (required)- Returns:
- this builder
-
prefixedToolName
Sets the prefixed tool name for the tool definition.Defaults to a generated name using the client and tool names.
- Parameters:
prefixedToolName- the prefixed tool name- Returns:
- this builder
-
toolContextToMcpMetaConverter
public AsyncMcpToolCallback.Builder toolContextToMcpMetaConverter(ToolContextToMcpMetaConverter toolContextToMcpMetaConverter) Sets the converter for tool context to MCP metadata transformation.Defaults to
ToolContextToMcpMetaConverter.defaultConverter().- Parameters:
toolContextToMcpMetaConverter- the converter- Returns:
- this builder
-
build
Builds an AsyncMcpToolCallback with the configured parameters.- Returns:
- a new AsyncMcpToolCallback
- Throws:
IllegalArgumentException- if required parameters are missing
-