Skip to content

Duplicate tool names across MCP servers cause errors #464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nikhil-pandey opened this issue Apr 9, 2025 · 2 comments
Open

Duplicate tool names across MCP servers cause errors #464

nikhil-pandey opened this issue Apr 9, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@nikhil-pandey
Copy link

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.

@nikhil-pandey nikhil-pandey added the bug Something isn't working label Apr 9, 2025
@rm-openai
Copy link
Collaborator

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_prefix arg that lets the user specify a custom prefix or indicate that we should prefix the server name.

PR welcome!

@stevemadere
Copy link

Would a workaround for this problem be a general purpose tool prefixer decorator class?

class MCPToolUniqifier(MCPServer):
  def __init(self, actual_server: MCPServer, tool_name_prefix: string):
     self.actual_server = actual_server
     self.tool_name_prefix = tool_name_prefix

 for f in every_other_method:
      apply_the_prefix_as_needed_and_proxy



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants