Class SyncMcpToolCallback
java.lang.Object
org.springframework.ai.mcp.SyncMcpToolCallback
- All Implemented Interfaces:
org.springframework.ai.tool.ToolCallback
Synchronous adapter bridging MCP tools to Spring AI's
ToolCallback interface.
Handles tool execution and data conversion between MCP and Spring AI.- Since:
- 1.0.0
- Author:
- Christian Tzolov, YunKui Lu, Ilayaperumal Gopinathan
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder forSyncMcpToolCallbackinstances. -
Constructor Summary
ConstructorsConstructorDescriptionSyncMcpToolCallback(io.modelcontextprotocol.client.McpSyncClient mcpClient, io.modelcontextprotocol.spec.McpSchema.Tool tool) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic SyncMcpToolCallback.Builderbuilder()Creates a builder for constructingSyncMcpToolCallbackinstances.Returns the original MCP tool name without prefixing.org.springframework.ai.tool.definition.ToolDefinitionMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.tool.ToolCallback
getToolMetadata
-
Constructor Details
-
SyncMcpToolCallback
@Deprecated public SyncMcpToolCallback(io.modelcontextprotocol.client.McpSyncClient mcpClient, io.modelcontextprotocol.spec.McpSchema.Tool tool) Deprecated.usebuilder()insteadCreates a callback with default settings.- Parameters:
mcpClient- the MCP client for tool executiontool- the MCP tool to adapt
-
-
Method Details
-
getToolDefinition
public org.springframework.ai.tool.definition.ToolDefinition getToolDefinition()- Specified by:
getToolDefinitionin interfaceorg.springframework.ai.tool.ToolCallback
-
getOriginalToolName
Returns the original MCP tool name without prefixing.- Returns:
- the original tool name
-
call
-
call
-
builder
Creates a builder for constructingSyncMcpToolCallbackinstances.- Returns:
- a new builder
-
builder()instead