Class AsyncMcpToolCallback.Builder

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

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

      public AsyncMcpToolCallback.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 AsyncMcpToolCallback.Builder prefixedToolName(String 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

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