Repository navigation
Description
Describe the bug
When using multiple MCP servers with identically named tools (but potentially different behaviors or arguments) in OpenAI's Agents SDK, the SDK raises a Duplicate tool names found across MCP servers error, preventing simultaneous usage.
This is particularly problematic when integrating with third-party MCP servers—name collisions might be unavoidable. For instance, both GitHub and Linear MCP servers might expose a tool called create_issue, making it impossible to use both without tool name differentiation which the consumer has no control over.
Debug information
- Agents SDK version: v0.0.8
- Python version: Python 3.13.2
Repro steps
Run the following minimal Python script:
import json
from agents import Agent, Runner
from agents.mcp.server import MCPServerStdio
import asyncio
async def main():
async with MCPServerStdio(params={"command": "terminal-stdio", "args": []}) as server:
async with MCPServerStdio(params={"command": "some-other-stdio", "args": []}) as server2:
tools = await server.list_tools()
print("Tools: ", json.dumps(tools, indent=4, default=lambda o: o.__dict__))
agent = Agent(
name="Assistant",
instructions="Use the tools to achieve the task",
mcp_servers=[server, server2],
model="gpt-4o-mini"
)
result = await Runner.run(agent, "Hi there, how are you?")
print("Result: ", result.final_output)
if __name__ == "__main__":
asyncio.run(main())Expected behavior
The SDK should either namespace or differentiate identically named tools from different MCP servers, allowing simultaneous and clear invocation of each distinct tool.
Crosslinks
Similar behavior observed in other MCP clients such as the VSCode where identically named tools across servers are de-duplicated or hidden from the UI, limiting usability in multi-server setups. Cursor on the other hand uses mcp_<server>_<tool_name> to avoid collisions and doesn't run into this.
Activity
rm-openai commentedon Apr 11, 2025
It probably would not be correct to edit the tool name - among other reasons, tools often have a 64 max character limit, and their names are carefully chosen.
Perhaps we should add an optional
append_prefixarg that lets the user specify a custom prefix or indicate that we should prefix the server name.PR welcome!
stevemadere commentedon May 17, 2025
Would a workaround for this problem be a general purpose tool prefixer decorator class?
yulong-CSAI commentedon Jun 20, 2025
It's not elegant to nest multiple MCP servers. Are there any non - nested implementation methods?
hayescode commentedon Dec 12, 2025
@seratch We could perhaps leverage the
namein the MCP Servers, but since the MCP tools themselves show as FunctionTool the only "name" is the tool's name and the server_name here (deepwiki) doesn't seem to be retrieveable anywhere?fix: handle duplicate tool names across MCP servers by auto-renaming
fix: handle duplicate tool names across MCP servers by auto-renaming
fix: handle duplicate tool names across MCP servers by auto-renaming
feat(mcp): add tool_name_prefix to disambiguate duplicate MCP tool names
Address review: narrow hint to non-prefixed path and cover both entry…