Package org.springframework.ai.mcp
Class SyncMcpToolCallback.Builder
java.lang.Object
org.springframework.ai.mcp.SyncMcpToolCallback.Builder
- Enclosing class:
- SyncMcpToolCallback
Builder for
SyncMcpToolCallback
instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds aSyncMcpToolCallback
with the configured parameters.mcpClient
(io.modelcontextprotocol.client.McpSyncClient mcpClient) Sets the MCP client for tool execution.prefixedToolName
(String prefixedToolName) Sets the prefixed tool name.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 SyncMcpToolCallback.Builder mcpClient(io.modelcontextprotocol.client.McpSyncClient 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. If not specified, a default prefix is generated.- Parameters:
prefixedToolName
- the prefixed tool name- Returns:
- this builder
-
toolContextToMcpMetaConverter
public SyncMcpToolCallback.Builder toolContextToMcpMetaConverter(ToolContextToMcpMetaConverter toolContextToMcpMetaConverter) Sets the converter for tool context to MCP metadata transformation. Defaults toToolContextToMcpMetaConverter.defaultConverter()
.- Parameters:
toolContextToMcpMetaConverter
- the converter- Returns:
- this builder
-
build
Builds aSyncMcpToolCallback
with the configured parameters.- Returns:
- a new
SyncMcpToolCallback
- Throws:
IllegalArgumentException
- if required parameters are missing
-