Security, Governance and PlatformUntrusted input and toolsPrincipal
How should an agent distinguish same-named tools from different MCP servers?
By Amit Kumar3 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
A host merges a company document server and a third-party research server, both exposing search. A review screen authorizes search, and a later log records that name with confidential case details. Design capability identity, display, routing and audit so the selected destination is unambiguous even after registration order changes, reconnects or definition updates.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
The unqualified name is not enough. MCP tool calls identify a tool by name on a particular server connection. Once a host merges several servers into one catalog, it owns the mapping between the model-visible choice and the actual destination. If it flattens everything into a map keyed only by search, the last registered server may replace the first, or a human review may authorize the wrong destination. The exact behavior depends on the host implementation. The protocol does not make a global cross-server namespace safe by itself.
I would give each offered capability a stable host identity bound to the server connection, authenticated server identity where available, tool name and definition version. Display the destination and data that will be sent on the review screen. Authorize against that resolved capability and the current user's scope, then execute through the same binding. Audit both the model-visible alias and the resolved destination. Do not use a server-supplied display title as the security identity. A malicious server can choose a reassuring title or description. A tool's annotations are also untrusted unless the server is trusted, as the MCP specification warns.
Now press on the hard case: a server reconnects or its tool schema changes between approval and execution. Re-resolve and compare the bound identity and definition. Material changes to destination, arguments or capability need a fresh decision, not a silent fallback to another search. Test two same-name tools with incompatible schemas, a swapped registration order, a reconnect and a forged friendly title. The expected outcome is either the reviewed destination or a stopped call, never whichever entry won a map collision.
A tool catalog changes while an agent is running already asks what happens when a tool catalog changes during a run. Here the sharp edge is the identity of one capability across servers, even when each server's own list is stable. A name by itself is a useful label for a person. It is not a sufficient authorization key.
For example, the host can present a stable internal capability ID mapped to company-docs/search at one approved endpoint and a different ID for partner-research/search. Human labels remain descriptive, while the executable record includes the resolved capability ID and catalog revision. The model may choose an alias, but the broker resolves it before policy evaluation and records the same binding used for network dispatch.
Do not reconstruct an old destination from the current catalog. If a registry entry was replaced after the call, its present meaning does not establish which server received yesterday’s query. Keep a versioned invocation record or trusted transport evidence naming the actual connection and destination. If the historical log stored only search and no such evidence survived, report that attribution is incomplete instead of guessing from today’s registration order.
The routing fixture should deliberately reverse the two servers’ order and give each a different harmless response marker. An approved call must still reach the intended fixture server. Add a reconnect that changes endpoint identity and a catalog update with the same tool name. The call should follow a reviewed, compatible binding or stop for a new decision. This tests cross-server identity. Checking that one server’s schema stayed unchanged tests a different property.
Related questions
Keep practising security, governance and platform
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux