Class McpTool

java.lang.Object
com.google.adk.tools.BaseTool
com.google.adk.tools.mcp.AbstractMcpTool<io.modelcontextprotocol.client.McpSyncClient>
com.google.adk.tools.mcp.McpTool

public final class McpTool extends AbstractMcpTool<io.modelcontextprotocol.client.McpSyncClient>
Initializes a MCP tool.

This wraps a MCP Tool interface and an active MCP Session. It invokes the MCP Tool through executing the tool from remote MCP Session.

  • Constructor Details

    • McpTool

      public McpTool(io.modelcontextprotocol.spec.McpSchema.Tool mcpTool, io.modelcontextprotocol.client.McpSyncClient mcpSession, McpSessionManager mcpSessionManager)
      Creates a new McpTool with the default ObjectMapper.
      Parameters:
      mcpTool - The MCP tool to wrap.
      mcpSession - The MCP session to use to call the tool.
      mcpSessionManager - The MCP session manager to use to create new sessions.
      Throws:
      IllegalArgumentException - If mcpTool or mcpSession are null.
    • McpTool

      public McpTool(io.modelcontextprotocol.spec.McpSchema.Tool mcpTool, io.modelcontextprotocol.client.McpSyncClient mcpSession, McpSessionManager mcpSessionManager, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      Creates a new McpTool with the default ObjectMapper.
      Parameters:
      mcpTool - The MCP tool to wrap.
      mcpSession - The MCP session to use to call the tool.
      mcpSessionManager - The MCP session manager to use to create new sessions.
      objectMapper - The ObjectMapper to use to convert JSON schemas.
      Throws:
      IllegalArgumentException - If mcpTool or mcpSession are null.
  • Method Details