agent: Sanitize MCP server IDs in tool name disambiguation#45789
Merged
bennetbo merged 4 commits intozed-industries:mainfrom Feb 12, 2026
Merged
agent: Sanitize MCP server IDs in tool name disambiguation#45789bennetbo merged 4 commits intozed-industries:mainfrom
bennetbo merged 4 commits intozed-industries:mainfrom
Conversation
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Jonathan Camp.
|
When multiple MCP servers expose tools with the same name, Zed
disambiguates them by prefixing the tool name with the server ID.
If the server ID contains spaces or special characters (e.g.,
"Azure DevOps"), the resulting tool name violates Anthropic's API
pattern `^[a-zA-Z0-9_-]{1,128}$`, causing API errors.
This fix converts server IDs to snake_case before using them as
prefixes, ensuring valid tool names are sent to the API.
Fixes zed-industries#40928
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
02b22bf to
53a3736
Compare
Contributor
Author
|
np. though I noticed that anthropic recently stopped returning that error when there was a space in the name. so maybe they changed their regex on what is valid? oh well. |
Member
|
Could be, but I think it still makes sense to normalise as other providers might have similar limitations (e.g. OpenAI) |
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.
Release Notes:
Summary
When multiple MCP servers expose tools with the same name, Zed disambiguates them by prefixing the tool name with the server ID from settings.json. If the server ID contains spaces or special characters (e.g.,
"Azure DevOps"), the resulting tool name likeAzure DevOps_echoviolates Anthropic's API pattern^[a-zA-Z0-9_-]{1,128}$, causing API errors:Solution
Convert server IDs to snake_case (using the
heckcrate already available in the workspace) before using them as prefixes during tool name disambiguation."Azure DevOps"azure_dev_ops_echo"My MCP Server"my_mcp_server_echoTest plan
test_mcp_tool_truncationAfter (left), Before (right):
🤖 Generated with (some) help from Claude Code