Skip to content

fix(mcp): qualify MCP tool names by the resource that owns them - #1106

Merged
radugheo merged 1 commit into
mainfrom
fix/mcp-tool-name-namespacing
Sep 22, 2026
Merged

radugheo merged 1 commit into
mainfrom
fix/mcp-tool-name-namespacing

Conversation

@radugheo

@radugheo radugheo commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator
  • MCP scopes tool names per server, so two connected MCP servers exposing the same tool name produced two identically named tools in the one flat list handed to the model. The provider rejected the request as a duplicate definition before any LLM call, so every prompt failed.
  • The LLM-facing name is now mcp-{resource}-tool-{tool}, built by mcp_tool_identity(), matching the format the Temporal runtime uses. Resource names are unique within an agent definition, so the pair is unique by construction.
  • A pair past the provider's 64-character cap is truncated and carries a digest of the full pair, so a shared prefix cannot reintroduce the collision.
  • create_tool_node raises AgentStartupError(INVALID_TOOL_CONFIG) on a duplicate tool name instead of silently keeping the last tool and routing both tools' calls to it. The message names both tools and the resources they came from.
  • Tool execution is unchanged: call_tool still uses the raw MCP name, and metadata["display_name"] still carries it for span titles.

Behaviour change: every MCP tool gets a new LLM-facing name, not only colliding ones. Eval sets asserting the old names need updating, which they do not today.

Needs a release before UiPath/uipath-agents-python#763 can bump its pin and merge.

PRODEV-1599

Copilot AI lite review requested due to automatic review settings September 21, 2026 15:34

This comment was marked as resolved.

@radugheo
radugheo force-pushed the fix/mcp-tool-name-namespacing branch 4 times, most recently from b6b5add to 8cffc5e Compare September 21, 2026 17:07
@radugheo
radugheo requested a lite review from Copilot September 21, 2026 17:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Sanitized MCP names can bypass TOOL-scope guardrails, and duplicate-name remediation is inaccurate for generic tools.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)
Resolved since last review (2)

Comment thread src/uipath_langchain/agent/react/guardrails/guardrails_subgraph.py
Comment thread src/uipath_langchain/agent/tools/tool_node.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Qualified MCP names can bypass guardrail matching for names that require sanitization or truncation.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Low severity

Open (1)
Resolved since last review (2)

Comment thread src/uipath_langchain/agent/tools/tool_node.py Outdated
@radugheo
radugheo force-pushed the fix/mcp-tool-name-namespacing branch from 99fe391 to a63125f Compare September 22, 2026 14:50
MCP scopes tool names per server. The Unified Runtime put the raw tool name
into the one flat tool list it hands the model, so two connected MCP servers
exposing the same tool name produced two identically named tools: the provider
rejected the request as a duplicate definition before any LLM call, and the
graph's tool-node map -- keyed by that name -- would have kept only the last
one and routed both servers' calls to it.

The name is now mcp-{resource}-tool-{tool}, matching the format the Temporal
runtime has always used, so traces and eval assertions read the same on either
runtime. Resource names are unique within an agent definition, so the pair is
unique by construction; a pair past the provider's 64-character cap is
truncated and carries a digest of the full pair.

create_tool_node now refuses a duplicate name instead of silently overwriting,
naming both tools and the resources they came from. Since #1072 the provider's
own 400 no longer relays its message, so a collision from any other source
(A2A cards, sanitization) would otherwise surface only as a generic rejection.

Alternatives considered: qualifying only on collision, which would make a
tool's identity depend on which other servers happen to be attached, so adding
a second server would silently rename the first server's tools.

PRODEV-1599
@radugheo
radugheo force-pushed the fix/mcp-tool-name-namespacing branch from a63125f to 41b4c82 Compare September 22, 2026 14:57
@sonarqubecloud

Copy link
Copy Markdown

@radugheo
radugheo merged commit c80fe8c into main Sep 22, 2026
48 checks passed
@radugheo
radugheo deleted the fix/mcp-tool-name-namespacing branch September 22, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants