fix MCP tool name prefix stripping in callTool#2837
Merged
Conversation
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
The fix correctly addresses the root cause: callTool was forwarding the prefixed tool name (e.g. github-official_get_issue) to the remote MCP server, which only knows the unprefixed name (get_issue), causing every catalog tool call to fail with "tool not found".
Fix analysis:
strings.TrimPrefix(name, ts.name+"_")is the right primitive — it strips exactly one leading occurrence of<name>_and is a no-op whents.nameis empty (unnamed toolsets) or the prefix is absent (misrouted calls)- No off-by-one, no nil-dereference (Go strings are never nil), no double-stripping (TrimPrefix is not iterative)
- The
ts.name != ""guard avoids any inadvertent behavior for unnamed toolsets
Test coverage is thorough — TestToolsAndCallToolRoundTrip and TestCallToolStripsToolsetNamePrefix together cover: named toolsets, unnamed toolsets, hyphenated catalog IDs, double-prefix tool names, and unprefixed calls forwarded unchanged.
No issues found in the changed lines.
gtardif
approved these changes
May 20, 2026
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.
Tool calls when using the mcp catalog builtin tool would fail because a prefix is added to each tool in order to avoid conflicts