`Class AbstractMcpTool<T>`

java.lang.Object
com.google.adk.tools.BaseTool
com.google.adk.tools.mcp.AbstractMcpTool<T>
Type Parameters:
T - The type of the MCP session client.
Direct Known Subclasses:
McpAsyncTool, McpTool

public abstract class AbstractMcpTool<T> extends BaseTool
MCP工具的基类。
  • 字段详情

    • mcpTool

      protected final io.modelcontextprotocol.spec.McpSchema.Tool mcpTool
    • mcpSessionManager

      protected final McpSessionManager mcpSessionManager
    • objectMapper

      protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
    • mcpSession

      protected volatile T mcpSession
  • 构造函数详细信息

    • AbstractMcpTool

      protected AbstractMcpTool(io.modelcontextprotocol.spec.McpSchema.Tool mcpTool, T mcpSession, McpSessionManager mcpSessionManager, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
  • 方法详细信息(Method Details)

    • annotations

      public io.modelcontextprotocol.spec.McpSchema.ToolAnnotations annotations()
    • meta

      public Map<String,Object> meta()
    • getMcpSession

      public T getMcpSession()
    • declaration

      public Optional<com.google.genai.types.FunctionDeclaration> declaration()
      描述内容复制自相关类: BaseTool
      获取(所需的信息或数据) FunctionDeclaration 该工具的表示方式(即如何展示或使用该工具)。
      Overrides:
      declaration in class BaseTool
    • wrapCallResult

      protected static Map<String,Object> wrapCallResult(com.fasterxml.jackson.databind.ObjectMapper objectMapper, String mcpToolName, io.modelcontextprotocol.spec.McpSchema.CallToolResult callResult)