Repository navigation
fix(mcp): shorten registered MCP tool names to fit provider limits - #15617
Open
guantik-gm wants to merge 1 commit into
Open
guantik-gm wants to merge 1 commit into
guantik-gm wants to merge 1 commit into
Conversation
teknium1
reviewed
Jul 12, 2026
teknium1
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the targeted regression coverage. The underlying length-limit problem is still present on current main: tools/mcp_tool.py:4484 returns an unbounded concatenated MCP name, and both normal schemas (:4498) and utility schemas (:4515, :4526) use that helper.
Problems
- The PR edits the obsolete
mcp_<server>_<tool>construction. Current main moved native MCP names to the centralizedmcp_prefixed_tool_name()helper andmcp__<server>__<tool>format in commite01f58ff1(tools/mcp_tool.py:4477-4484). The patch therefore needs a focused salvage rather than applying at its original sites.
Suggested changes
- Put the stable length guard in the shared helper so normal and utility MCP names cannot drift.
- Update the tests for the current
mcp__format and keep the original-name dispatch assertion; registration still builds handlers withmcp_tool.nameattools/mcp_tool.py:4794.
Automated hermes-sweeper review.
| @@ -2391,7 +2408,7 @@ def _convert_mcp_schema(server_name: str, mcp_tool) -> dict: | |||
| """ | |||
Collaborator
There was a problem hiding this comment.
Current main no longer constructs native MCP names here: commit e01f58ff1 centralized the mcp__<server>__<tool> convention in mcp_prefixed_tool_name(). Apply the length guard in that shared helper so _convert_mcp_schema() and utility schemas use the same current naming path.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
Some providers and backends reject oversized tool names. This patch keeps generated MCP tool schemas within those limits without breaking dispatch to the original MCP server tool name.
Test Plan
python -m pytest tests/tools/test_mcp_tool.py -q -o 'addopts='