Class McpAsyncTool
java.lang.Object
com.google.adk.tools.BaseTool
com.google.adk.tools.mcp.AbstractMcpTool<io.modelcontextprotocol.client.McpAsyncClient>
com.google.adk.tools.mcp.McpAsyncTool
public final class McpAsyncTool
extends AbstractMcpTool<io.modelcontextprotocol.client.McpAsyncClient>
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class BaseTool
BaseTool.ToolArgsConfig, BaseTool.ToolConfig -
Field Summary
Fields inherited from class AbstractMcpTool
mcpSession, mcpSessionManager, mcpTool, objectMapper -
Constructor Summary
ConstructorsConstructorDescriptionMcpAsyncTool(io.modelcontextprotocol.spec.McpSchema.Tool mcpTool, io.modelcontextprotocol.client.McpAsyncClient mcpSession, McpSessionManager mcpSessionManager) Creates a new McpAsyncTool with the default ObjectMapper.McpAsyncTool(io.modelcontextprotocol.spec.McpSchema.Tool mcpTool, io.modelcontextprotocol.client.McpAsyncClient mcpSession, McpSessionManager mcpSessionManager, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Creates a new McpAsyncTool -
Method Summary
Methods inherited from class AbstractMcpTool
annotations, declaration, getMcpSession, meta, wrapCallResultMethods inherited from class BaseTool
customMetadata, description, fromConfig, longRunning, name, processLlmRequest, setCustomMetadata
-
Constructor Details
-
McpAsyncTool
public McpAsyncTool(io.modelcontextprotocol.spec.McpSchema.Tool mcpTool, io.modelcontextprotocol.client.McpAsyncClient mcpSession, McpSessionManager mcpSessionManager) Creates a new McpAsyncTool 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.
-
McpAsyncTool
public McpAsyncTool(io.modelcontextprotocol.spec.McpSchema.Tool mcpTool, io.modelcontextprotocol.client.McpAsyncClient mcpSession, McpSessionManager mcpSessionManager, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Creates a new McpAsyncTool- 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
-
runAsync
-