Skip to content

fix: add hint to duplicated MCP server tool name error message - #3678

Merged
seratch merged 2 commits into
openai:mainfrom
wustwyh:fix/mcp-duplicate-tool-names-hint
Jun 23, 2026
Merged

seratch merged 2 commits into
openai:mainfrom
wustwyh:fix/mcp-duplicate-tool-names-hint

Conversation

@wustwyh

@wustwyh wustwyh commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

…e errors

When multiple MCP servers expose identically-named tools, the SDK raises a UserError. Update that error message to mention the existing mcp_config={'include_server_in_tool_names': True} option, which prefixes tool names with their server name to avoid collisions.

Fixes #464

…e errors

When multiple MCP servers expose identically-named tools, the SDK
raises a UserError. Update that error message to mention the existing
mcp_config={'include_server_in_tool_names': True} option, which
prefixes tool names with their server name to avoid collisions.

Fixes openai#464
@seratch seratch changed the title feat(mcp): hint at include_server_in_tool_names on duplicate tool nam… fix: add hint to duplicated MCP server tool name error message Jun 23, 2026

@seratch seratch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before merging, please narrow the hint to the non-prefixed path and make it actionable for both supported entry points. MCPUtil.get_all_function_tools() can be called directly, in which case changing agent.mcp_config does not affect that call; the caller must pass include_server_in_tool_names=True. Also, the current patch adds the same hint inside the branch where that option is already enabled, so that message would be contradictory if the defensive check fired.

Please update the wording and regression coverage for those paths. After that, this should be a small, mergeable usability improvement.

… points

- Remove the hint from the include_server_in_tool_names=True branch,
  since suggesting the same option there would be contradictory.
- Reword the hint in the default branch to mention both entry points:
  passing include_server_in_tool_names=True to MCPUtil.get_all_function_tools()
  and setting mcp_config on the Agent.
- Add regression test ensuring the prefixed path raises a plain duplicate
  error without the hint.

Related to openai#464
@wustwyh

wustwyh commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I've pushed the requested changes:

Narrowed the hint to the non-prefixed path only.
Reworded the hint to be actionable for both entry points (MCPUtil.get_all_function_tools(..., include_server_in_too l_names=True) and Agent(mcp_config={...})).
Added a regression test for the prefixed path to ensure it raises the plain duplicate error without the hint.

Please take another look.

@seratch seratch added this to the 0.17.x milestone Jun 23, 2026
@seratch
seratch enabled auto-merge (squash) June 23, 2026 05:57
@seratch
seratch merged commit 2df8adc into openai:main Jun 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate tool names across MCP servers cause errors

2 participants