McpToolset
Connects to an MCP Server and exposes the server's MCP tools to an agent as ADK BaseTools.
McpToolset manages the lifecycle of the connection to a single MCP server and lazily fetches the server's tool list on first use. The instance can then be passed directly to an LlmAgent's toolsets.
Instances are created via McpToolsetConfig.toToolset, for example:
val toolset =
McpToolset.McpToolsetConfig(
stdioConnectionParams =
McpConnectionParameters.Stdio(
command = "npx",
args = listOf("-y", "@modelcontextprotocol/server-filesystem"),
),
toolFilter = listOf("read_file", "list_directory"),
)
.toToolset()The constructor is internal; user code should use McpToolsetConfig.toToolset instead.
Types
Configuration for an McpToolset, used to construct one via toToolset.
Functions
Return all tools in the toolset based on the provided context.
Returns a list of resource names available on the MCP server.
Allows the toolset to process the LLM request.
Fetches and returns a list of contents of the resource with the given URI.