Skip to content

fix: missing reserved_tool_names argument in non-prefixed tool path#3559

Closed
mshsheikh wants to merge 1 commit into
openai:mainfrom
mshsheikh:patch-43
Closed

fix: missing reserved_tool_names argument in non-prefixed tool path#3559
mshsheikh wants to merge 1 commit into
openai:mainfrom
mshsheikh:patch-43

Conversation

@mshsheikh
Copy link
Copy Markdown
Contributor

In MCPUtil.get_all_function_tools(), the reserved_tool_names parameter was correctly forwarded when include_server_in_tool_names was set to True, but was silently dropped in the fallback loop that processes servers without name prefixing.

This omission allowed MCP tools to be registered with names that could conflict with internal SDK reserved names. The conflict would bypass the intended reservation check, potentially causing ambiguous tool routing or unexpected behavior when agents invoke tools that share names with protected SDK functions.

The fix adds the reserved_tool_names argument to the get_function_tools() call in the non-prefixed execution branch. This restores consistent name reservation logic across both code paths and ensures that SDK-reserved identifiers are always protected during tool discovery.

The change is fully backward compatible, introduces no new dependencies, and does not alter any public API signatures. All existing unit tests pass without modification.

In MCPUtil.get_all_function_tools(), the reserved_tool_names parameter was correctly forwarded when include_server_in_tool_names was set to True, but was silently dropped in the fallback loop that processes servers without name prefixing.

This omission allowed MCP tools to be registered with names that could conflict with internal SDK reserved names. The conflict would bypass the intended reservation check, potentially causing ambiguous tool routing or unexpected behavior when agents invoke tools that share names with protected SDK functions.

The fix adds the reserved_tool_names argument to the get_function_tools() call in the non-prefixed execution branch. This restores consistent name reservation logic across both code paths and ensures that SDK-reserved identifiers are always protected during tool discovery.

The change is fully backward compatible, introduces no new dependencies, and does not alter any public API signatures. All existing unit tests pass without modification.
@seratch seratch changed the title Fix missing reserved_tool_names argument in non-prefixed tool path fix: missing reserved_tool_names argument in non-prefixed tool path Jun 4, 2026
@seratch
Copy link
Copy Markdown
Member

seratch commented Jun 4, 2026

After tracing the call path, this change does not affect runtime behavior. In the non-prefixed path, get_function_tools() only uses reserved_tool_names when include_server_in_tool_names=True. The caller in this branch does not pass that flag, so it remains False and the forwarded argument is unused. reserved_tool_names is needed for allocating generated prefixed names without collisions. It does not apply when MCP tool names are exposed unchanged.

Closing this PR as no-op. Thanks again for taking the time to investigate this.

@seratch seratch closed this Jun 4, 2026
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.

2 participants