Class SyncMcpToolCallback.Builder

java.lang.Object
org.springframework.ai.mcp.SyncMcpToolCallback.Builder
Enclosing class:
SyncMcpToolCallback

public static final class SyncMcpToolCallback.Builder extends Object
Builder for SyncMcpToolCallback instances.
  • 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

      public SyncMcpToolCallback.Builder tool(io.modelcontextprotocol.spec.McpSchema.Tool tool)
      Sets the MCP tool to adapt.
      Parameters:
      tool - the MCP tool (required)
      Returns:
      this builder
    • prefixedToolName

      public SyncMcpToolCallback.Builder prefixedToolName(String 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 to ToolContextToMcpMetaConverter.defaultConverter().
      Parameters:
      toolContextToMcpMetaConverter - the converter
      Returns:
      this builder
    • build

      public SyncMcpToolCallback build()
      Builds a SyncMcpToolCallback with the configured parameters.
      Returns:
      a new SyncMcpToolCallback
      Throws:
      IllegalArgumentException - if required parameters are missing