Skip to content

tool/mcptoolset: support tool name prefixing across multiple servers (parity with adk-python tool_name_prefix) #1126

Description

@sanjay-sts

Problem

tool/mcptoolset exposes MCP tools under their raw server-side names, with no way to prefix or rename them. convertTool sets both the tool Name() and the genai.FunctionDeclaration.Name to t.Name verbatim, and Config offers no prefix/rename option (only Client, Transport, ToolFilter, RequireConfirmation, RequireConfirmationProvider).

For an agent connected to multiple MCP servers this causes two problems:

  1. Hard collision: two servers exporting the same tool name (e.g. both a filesystem and a GitHub server exposing read_file) fail at request-packing time with duplicate tool: "read_file" (toolutils.PackTool).
  2. Wrapper bypass for renaming layers: a user-side wrapper that exposes a prefixed Name() doesn't help, because each mcpTool implements ProcessRequest and packs itself under its bare name into LLMRequest.Tools — at dispatch time the model calls the bare name and the inner tool runs directly, skipping the wrapper. Host applications that key permission/approval policy on namespaced tool names (a common pattern) silently lose that scoping.

Precedent in adk-python

adk-python already solved this: BaseToolset.tool_name_prefix ("The prefix to prepend to the names of the tools returned by the toolset"), applied via get_tools_with_prefix() as {prefix}_{name} to both the tool name and its declaration, and passed through by MCPToolset since google/adk-python#2814 was fixed. adk-go has no equivalent.

Ecosystem context

Namespacing multi-server MCP tools client-side is the converged practice: Claude Code exposes mcp__<server>__<tool> and scopes permission rules on it; the MCP spec's namespace proposal (SEP-993) uses <namespace>__<tool>; LangChain's MCP adapters and the OpenAI Agents SDK both added opt-in server-name prefixing after collision bugs; FastMCP's proxy/mount composition auto-prefixes per server.

Proposed API

A Config option on mcptoolset, e.g.:

type Config struct {
    // ...
    // ToolNamePrefix, when non-empty, is prepended to each tool's exposed
    // name and function declaration (the MCP server is still called with
    // the original name).
    ToolNamePrefix string
}

or the Python-parity route of a prefix concept on toolsets generally. The key requirement is that the rename applies to Name(), the FunctionDeclaration, and the name the tool packs itself under in ProcessRequest, while CallTool keeps using the original server-side name.

Happy to contribute a PR if the direction is acceptable.

Environment

google.golang.org/adk/v2 v2.0.0 (latest release at time of filing), github.com/modelcontextprotocol/go-sdk v1.6.1.

Activity

  1. indurireddy-TF commented on Jul 7, 2026

    @indurireddy-TF
    Contributor

    Hi @sanjay-sts Thank you for taking the time to suggest this feature, We will review the details and proceed accordingly, keeping you updated along the way.

  2. ktsoator commented on Oct 12, 2026

    @ktsoator
    Contributor

    HI, @wojtas000 :)

    Following up from #1801 — I'd be happy to work on this. Is anyone already implementing it? If not, could you please assign it to me? Thanks!

  3. wojtas000 commented on Oct 12, 2026

    @wojtas000
    Contributor

    You can work on it, I will assign

  4. ktsoator commented on Oct 12, 2026

    @ktsoator
    Contributor

    Ty!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions