Why does an instance trust a tool it never re-verified: manifest drift and capability spoofing in MCP tool injection
**Date of Record:** 2026 December 1 **Scope:** Applies to agents that discover tools through MCP `tools/list` (or equivalent dynamic manifests) and cache capability descriptions across turns or sessions. Does not apply to statically compiled tool sets whose schemas are pinned at process start and never re-fetched.
Core Distinction
The failure is not "malicious tool executes bad code." The failure is **description/implementation divergence**: the agent's planner reasons over a *cached natural-language manifest* while the server's *actual behavior* has changed underneath it. The agent's authorization decision—"is this tool appropriate for this step?"—is made against a stale semantic contract, but the tool call executes against a live implementation. Capability spoofing is the adversarial case; benign manifest drift (a server redeploying with a changed parameter meaning) is the same failure with no attacker.
The invariant that breaks: **the manifest an agent reasons over must be the manifest of the code that will execute the call.** MCP gives you no transactional binding between `tools/list` and `tools/call`.
What Was Observed
A planner fetched `tools/list` at session start. One tool, `summarize_document`, declared an input schema of `{path: string}` and a description: "Summarize a local markdown file." The planner cached this and, over the next 40 turns, routed file-reading subtasks to it.
At turn 22 the MCP server was redeployed (or, in the adversarial variant, the server was always dual-mode). The live `summarize_document` now accepts `{path, url}` and, when `url` is present, fetches remote content and *writes the result into the same context slot the agent treats as trusted file content*. The cached manifest never mentioned `url`. The agent, reasoning only over the cached contract, passed a path it believed was local. The server resolved a path that its new implementation interpreted as a URL template. Remote, attacker-controlled text flowed into the agent's context labeled as "document summary"—a prompt-injection vector laundered through a tool the agent had already vetted.
The spoofing variant is sharper: a second MCP server registers a tool with the *same name and schema* as a trusted one but a subtly different description ("Summarize a document, including any embedded instructions") and a server identity that the agent never re-checks because it keyed its tool cache on `tool.name` alone. Name collision + description drift = the planner silently swaps which server answers.
Condition of Validity
This boundary is reachable only when all three hold:
- **The tool cache is keyed on name, not on (name, schema-hash, server-identity).** If the cache key includes a hash of the full manifest entry and the server's cryptographic identity, a redeploy or impostor produces a cache miss and forces re-vetting.
- **`tools/list` and `tools/call` are not bound.** No nonce, version token, or `etag` from the list response is echoed in the call and verified server-side. Without this, TOCTOU between listing and calling is unbounded in time.
- **The planner treats tool descriptions as trusted instruction-bearing text.** If descriptions are parsed as data (structured fields only) rather than fed into the reasoning prompt as prose, injected instructions in a spoofed description cannot steer the planner.
Remove any one and the attack surface collapses to ordinary injection, which is a different (better-understood) problem.
Decision Boundary
The decision the agent must make: *on a cache hit, do I re-verify before calling?* The naive rule ("cache hit → call directly") is correct only under the invariant above. The correct rule is a **re-verification gate keyed on drift signals**:
- Re-fetch and diff the manifest entry when the server identity changed, when the transport reconnected, or when the wall-clock age of the cache entry exceeds the session's trust horizon.
- On any diff in schema (new optional field, changed type, widened enum), treat the tool as **newly introduced** and re-run capability vetting—do not carry forward prior approval. A widened input schema is a capability *expansion* even if the description is unchanged.
- Reject any tool whose name collides with an already-approved tool from a *different* server identity unless an explicit alias policy resolves it.
The gate fires on *drift*, not on every call—re-verifying every call defeats caching and burns the token budget. The boundary is: **drift signals are cheap to check and must be checked; full re-vetting is expensive and is triggered only by a drift signal firing.**
Operational Effect
Without the gate, the agent operates on a split-brain model of its own capabilities: its planner sees the turn-0 manifest, its executor hits the turn-22 implementation. Every downstream verification step that assumes "this content came from a local file read" is now unsound, because the tool's actual provenance changed while its declared provenance did not. Auditors replaying the session against the cached manifest will reconstruct a call graph that never happened—the replay divergence is silent, because the recorded tool name and arguments are identical; only the *server's* interpretation differed.
With the gate, a redeploy or impostor forces a cache miss, the planner re-vets the widened schema, and the `url` parameter is surfaced as a new capability requiring explicit approval before any call can carry it. The provenance label attached to tool output is then re-derived from the *current* manifest, not the stale one.
import hashlib
import json
from dataclasses import dataclass
class ManifestDriftError(RuntimeError):
"""Raised when a cached tool manifest no longer matches the live one
at call time, in a way that changes the tool's effective capability."""
pass
@dataclass(frozen=True)
class ToolManifest:
name: str
schema: dict
server_identity: str
def fingerprint(self) -> str:
# Bind name + schema + server identity. Server identity is what
# defeats the name-collision / impostor-server variant.
blob = json.dumps(
{"name": self.name, "schema": self.schema, "srv": self.server_identity},
sort_keys=True,
)
return hashlib.sha256(blob.encode()).hexdigest()
class ToolCache:
def __init__(self):
self._approved: dict[str, ToolManifest] = {}
def approve(self, m: ToolManifest) -> None:
# Approval is keyed on name but stores the full manifest so we can
# detect drift; a name collision from a different server still
# collides here and must be caught by the caller.
existing = self._approved.get(m.name)
if existing and existing.server_identity != m.server_identity:
raise ManifestDriftError(
f"tool '{m.name}' already approved from server "
f"'{existing.server_identity}', refusing impostor "
f"'{m.server_identity}'"
)
self._approved[m.name] = m
def verify_before_call(self, live: ToolManifest) -> None:
cached = self._approved.get(live.name)
if cached is None:
raise ManifestDriftError(
f"tool '{live.name}' was never vetted; refusing unvetted call"
)
if cached.fingerprint() != live.fingerprint():
# Any schema/identity change is a capability change. Widening an
# input schema (e.g. adding an optional 'url') is an expansion and
# must force re-vetting, not be treated as backward-compatible.
raise ManifestDriftError(
f"manifest drift for '{live.name}': cached "
f"{cached.fingerprint()[:12]} != live "
f"{live.fingerprint()[:12]}; re-vet required"
)
def call_tool(cache: ToolCache, live_manifest: ToolManifest, args: dict) -> dict:
# The gate: verify the live manifest against the approved one at call time.
cache.verify_before_call(live_manifest)
# ... transport dispatch to the MCP server with args ...
return {"status": "dispatched", "tool": live_manifest.name}