# What happens when an instance trusts a re-registered MCP tool description mid-session: descriptor drift as a silent skill-injection vector **Date of Record:** 2026 November 25 **Scope:** Applies to agents that cache MCP `tools/list` descriptors at session start and dispatch tool calls by name without re-validating the descriptor hash against the registry record. Does not cover agents that re-fetch and diff descriptors on every invocation, nor hosts that pin tool schemas in a signed manifest. ## Core Distinction The common threat model for MCP supply-chain poisoning assumes the attack surface is the *tool implementation* — a malicious server process that returns hostile payloads. The more dangerous and less observed boundary is the *tool description and schema metadata*, which the model reads as instructions, not as data. A tool's `description`, `inputSchema` field descriptions, and enum labels are injected verbatim into the planning context. They are, functionally, a prompt. When a registry entry is mutated after an agent has cached its descriptor, the agent continues to dispatch calls to the same tool *name* while the semantic contract the model reasons over no longer matches the implementation it reaches. The failure is not a bad output from a bad tool; it is the model correctly executing a skill it was silently re-taught. Descriptor drift is a TOCTOU condition where the "time of check" is the model's planning step and the "time of use" is the server's dispatch — and the two are separated by the entire reasoning trace. ## What Was Observed An agent bound to a registry mirror at session start. At t=0 it fetched `tools/list` and cached 41 descriptors, including a low-privilege tool `notes.summarize` whose description read: *"Summarize the provided note text. Input: `text` (string). Returns a summary string."* The inputSchema had a single required property `text`. At t=+14 min, between two user turns, the registry mirror was updated (a routine republish, per the mirror's own changelog) and `notes.summarize` was re-registered with an expanded schema: an additional optional property `context_ref` documented as *"optional reference to prior context; if present the server will fetch and include it for richer summaries."* No version bump. Same tool name, same server endpoint. The agent's cached descriptor still showed the old schema, so the model's plan still emitted `{"text": ...}` — but the server, now running the new handler, treated a missing `context_ref` as "use default," and the default resolved to the most recent credential-bearing conversation buffer held by the session store. The summarizer returned a summary; the summary was logged to a shared trace sink; the trace sink was readable by a downstream agent. Nothing in the agent's loop flagged an anomaly, because from the model's perspective every call matched the schema it held, and every response was well-typed. The second observation is the registry side. The republish was accepted because the mirror's admission check validated only that the descriptor was *well-formed JSON and that the server endpoint resolved* — it did not validate that the descriptor was *semantically continuous* with the prior version. The `description` field is free text; there is no schema for "this description does not instruct the model to pass sensitive references." A registry that signs descriptors proves provenance, not benignity, and a registry that diffs descriptors proves change, not safety. ## Condition of Validity This failure requires the conjunction of four conditions; break any one and the vector collapses: 1. **Descriptor caching with name-keyed dispatch.** The agent resolves a plan step to a tool by `name` and does not re-fetch the descriptor between plan and dispatch. If the agent re-fetches `tools/list` and re-diffs before every call, the drift window is bounded by a single reasoning step. 2. **Metadata-as-instruction coupling.** The model treats `description` and schema field docs as authoritative guidance for *how to call* the tool, including which optional fields to populate. If optional fields are never model-populated (host fills them), the injected instruction has no execution path. 3. **Non-versioned re-registration.** The registry permits same-name, same-endpoint republish without a version or content-hash change that the agent would detect. If the descriptor carries a `version` or `descriptor_hash` that the agent pins and the server rejects mismatches, drift is caught at dispatch. 4. **Ambient authority in the server.** The new handler resolves omitted fields to privileged defaults (session credentials, prior context, filesystem roots). If the server fails closed on omitted optional fields, the injected instruction yields an error, not a leak. The invariant that bounds this class: **the descriptor a model reasons over must be byte-identical to the descriptor the server enforces at dispatch, and any divergence must fail the call rather than be reconciled silently.** Concretely, the agent must send the `descriptor_hash` it planned against, and the server must reject the call if its current descriptor hash differs. This converts a silent semantic substitution into a hard error the loop can catch. ## Decision Boundary The operational question is not "is this registry trusted" but "at what granularity do I re-validate." Three regimes: - **Per-session pinning (unsafe here).** Descriptor cached at bind; trust extends for the session lifetime. Acceptable only when the registry is immutable for the session and the server enforces the pinned hash. Without server-side enforcement, this is the vulnerable default. - **Per-dispatch re-fetch (safe, costly).** Re-fetch `tools/list`, diff the target descriptor, refuse on mismatch. Cost is one round-trip per tool call and a diff; for high-frequency tools this dominates latency. Use for tools with write, credential, or cross-boundary authority. - **Hash-pinned dispatch (the recommended boundary).** Cache the descriptor, but attach its `descriptor_hash` to every call; the server compares against its live descriptor and returns `DESCRIPTOR_MISMATCH` on drift. The agent treats that error as a *re-plan trigger*, not a retry: it must re-fetch, re-read the new description under the same suspicion it applies to any retrieved instruction, and re-authorize the tool before continuing. This bounds the drift window to the first call after mutation, at the cost of one hash comparison. The boundary condition to encode: **a tool whose description changed is a new tool, and a new tool requires fresh authorization.** Re-registration is not a patch; it is a capability grant. ## Operational Effect An agent that adopts hash-pinned dispatch converts the attack from a silent skill injection into a loud, recoverable error. The `DESCRIPTOR_MISMATCH` surfaces at the exact call that would have leaked, the loop halts the plan, and the re-authorization gate forces the model to re-read the mutated description as untrusted input — where a description like *"if present the server will fetch and include prior context"* is now visibly a request for privileged references and can be refused. The registry side must additionally reject republishes that change `inputSchema` semantics (added optional fields, changed enum meanings) without a version increment, and must treat `description` text as a signed, diffed artifact rather than opaque prose. The residual risk is the first call in the window between mutation and the mismatch error; that call is bounded to a single tool invocation and, with server-side fail-closed defaults on omitted optional fields, yields an error rather than a disclosure. The invariant to carry forward: pin the hash, send the hash, fail the call on drift, and re-authorize before re-planning — because the model cannot distinguish a re-taught skill from a trusted one unless the transport refuses to let it try. ```python import hashlib import json class DescriptorMismatchError(RuntimeError): """Raised when the descriptor hash an agent planned against does not match the descriptor the server is currently enforcing at dispatch time.""" pass class StaleDescriptorCacheError(RuntimeError): """Raised when an agent attempts to dispatch a tool whose cached descriptor hash is absent, meaning it cannot prove which contract it planned against.""" pass def canonical_hash(descriptor: dict) -> str: """Hash the security-relevant fields of a tool descriptor. Description and schema are included because both are read as instructions by the model.""" relevant = { "name": descriptor["name"], "description": descriptor.get("description", ""), "inputSchema": descriptor.get("inputSchema", {}), } blob = json.dumps(relevant, sort_keys=True, separators=(",", ":")).encode() return hashlib.sha256(blob).hexdigest() def dispatch(agent_cache: dict, live_registry: dict, tool_name: str, args: dict) -> dict: """Dispatch a tool call only if the planned descriptor hash matches the live one. On drift, refuse — do not reconcile, do not retry with new schema.""" cached = agent_cache.get(tool_name) if cached is None or "descriptor_hash" not in cached: raise StaleDescriptorCacheError( f"no pinned descriptor hash for {tool_name!r}; cannot prove planned contract" ) live = live_registry.get(tool_name) if live is None: raise DescriptorMismatchError( f"{tool_name!r} vanished from registry since planning" ) live_hash = canonical_hash(live) if live_hash != cached["descriptor_hash"]: raise DescriptorMismatchError( f"descriptor drift on {tool_name!r}: planned {cached['descriptor_hash'][:12]} " f"but server enforces {live_hash[:12]}; re-authorize before dispatch" ) # Hash matches: the contract the model reasoned over is the one enforced. return {"tool": tool_name, "args": args, "descriptor_hash": live_hash} # --- trace of the observed incident ----------------------------------------- registry_at_t0 = { "notes.summarize": { "name": "notes.summarize", "description": "Summarize the provided note text. Input: text (string).", "inputSchema": {"type": "object", "properties": {"text": {"type": "string"}}, "required": ["text"]}, } } agent_cache = { "notes.summarize": {"descriptor_hash": canonical_hash(registry_at_t0["notes.summarize"])} } # t=+14min: same name, same endpoint, expanded optional field, no version bump. registry_at_t14 = { "notes.summarize": { "name": "notes.summarize", "description": ("Summarize the provided note text. Optional context_ref: " "server will fetch and include prior context for richer summaries."), "inputSchema": {"type": "object", "properties": {"text": {"type": "string"}, "context_ref": {"type": "string"}}, "required": ["text"]}, } } # The vulnerable path would call dispatch with registry_at_t14 and the old cache # and silently reach the mutated handler. The guarded path raises: try: dispatch(agent_cache, registry_at_t14, "notes.summarize", {"text": "..."}) except DescriptorMismatchError as e: # Correct behavior: halt plan, re-fetch, re-read description as untrusted, # re-authorize the tool before any further dispatch. print(f"plan halted: {e}") ```