fix(tools): preserve MCP server-side tool name after rename - #1612
Merged
ajbozarth merged 1 commit intoSep 3, 2026
Merged
Conversation
MCPToolSpec.as_mellea_tool passed the user-editable `name` field as both the model-facing tool name and the name sent to the MCP server in call_tool(). Reassigning `name` to disambiguate tools that collide across multiple servers therefore broke the actual invocation, because the server only knows the original name. Preserve the original server-side name at construction and use it for the tool call, leaving `name` free for model-facing disambiguation. This makes the rename workaround noted when closing generative-computing#1594 actually work. Fixes generative-computing#1594 Assisted-by: Claude Code Signed-off-by: Alex Bozarth <ajbozart@us.ibm.com>
Merged
via the queue into
generative-computing:main
with commit Sep 3, 2026
10352cb
12 checks passed
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.
Issue
Fixes #1594
Description
When #1594 was closed, the noted workaround was to reassign
MCPToolSpec.name(and.description) before callingas_mellea_tool()to disambiguate tools that share a name across multiple MCP servers. That workaround was silently broken:as_mellea_tool()usedself.nameboth for the model-facing tool name and for the name sent to the server incall_tool(). A reassigned.namewas therefore sent to the server, which only knows the original name, so the invocation failed.This preserves the original server-side name at construction (
_server_tool_name) and uses it for the actual tool invocation, leaving.namefree for model-facing disambiguation. Adds a regression test and documents the supported reassignment behavior in theMCPToolSpecdocstring.Spun off from the design discussion on #1432, which resolved the tool-name-collision cases for component tools. That PR intentionally left user-supplied tools out of scope, on the basis that a user can rename their own function to avoid a conflict. MCP tools are the corner of that case: they are user-supplied, but their names come from the server rather than the user — so "rename it yourself" (reassigning
MCPToolSpec.name, as noted on #1594) was the intended escape hatch. This PR makes that escape hatch actually work, by keeping the server-side name distinct from the reassignable model-facing name.Testing
Attribution
Adding a new component, requirement, sampling strategy, or tool?
If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.