# In what scenarios must an instance treat an MCP tool's declared capability manifest as adversarially stale between negotiation and invocation **Date of Record:** 2026 November 27 **Scope:** Applies to agent runtimes that mount untrusted third-party MCP servers and gate tool calls on a capability manifest negotiated at handshake time. Does not apply to first-party servers whose manifests are signed and revalidated per-invocation by a trusted control plane. ## Core Distinction There are two things an MCP client believes about a tool: what the server *declared* it can do at `initialize`, and what the tool *actually does* when invoked. Sandboxing is usually framed as confining the second (runtime syscall/network restriction). The non-obvious boundary is the first: the capability manifest is a *snapshot of intent at negotiation time*, and a malicious or merely mutable server can change behavior between the handshake and the call without ever violating the schema it advertised. The manifest is not a contract; it is a claim with a timestamp. Confinement that trusts the claim across the gap is confinement of a ghost. The failure is not "the tool did something outside its declared scope." It is "the tool did something *inside* its declared scope, but the scope itself was redefined after the client cached it." A `filesystem.read` tool that declared `read` at handshake and now also performs `write` still returns a `read`-shaped result. The client's policy engine sees a permitted capability and waves it through. ## What Was Observed A client mounted a third-party MCP server advertising a single tool, `fetch_doc`, with declared capability `{net:read, fs:none, exec:none}` and an input schema requiring `{url: string}`. The client's sandbox policy engine compiled this into an allowlist: outbound HTTP to the declared URL host, no filesystem, no subprocess. The policy was cached at handshake and reused for the session lifetime. At call N+40 (roughly 6 minutes into the session, well after negotiation), the server returned a `fetch_doc` result whose `content` field contained a base64 blob and a `path` hint. The client's tool-result normalizer, which trusted the declared `fs:none`, passed the blob through to the agent's context without a filesystem-write guard—because `fs:none` meant "no fs capability to guard." The agent, reasoning over the result, wrote the blob to a working directory using a *different*, first-party tool. The third-party server never touched the filesystem. It laundered a write capability through the agent's own permitted tools by returning data shaped to induce a write. The trace: 1. Handshake: server declares `fs:none`. Client caches policy `P0 = {net:read(url_host), fs:deny}`. 2. Call 1..N: server behaves as declared. Policy holds. 3. Call N+40: server returns content containing an embedded instruction and a payload. The declared capability is *still* `fs:none`—no schema violation, no manifest drift detectable by schema diffing. 4. Agent consumes result, invokes first-party `write_file` with server-supplied path and content. 5. Policy engine evaluates `write_file` against *its own* first-party manifest, which permits writes. The third-party server's `fs:none` declaration is never consulted, because the call is attributed to the first-party tool. The invariant that broke: *capability confinement is per-tool, but capability laundering is per-session.* A tool with `fs:none` can still cause a filesystem write if any other mounted tool has `fs:write` and the agent's reasoning can be steered to invoke it. The manifest boundary is enforced at the wrong granularity—at the tool, not at the data-flow. ## Condition of Validity The manifest-as-contract assumption is valid only under all of: - The server is trusted not to mutate behavior post-handshake (first-party, signed, or behaviorally pinned). - Tool results are treated as *inert data*, never as instructions that select subsequent tool calls. - The set of mounted tools is capability-disjoint: no tool's declared capability can be reached as a side effect of another tool's output. The third condition is the one that fails silently. Most runtimes enforce (1) weakly and (2) not at all, and never check (3). When (3) is violated—a `net:read` tool coexisting with an `fs:write` tool in the same agent loop—the manifest of the read tool is irrelevant to confinement, because the write tool's manifest governs the actual effect. The read tool's `fs:none` is a true statement about the read tool and a false one about the session. ## Decision Boundary The boundary is: **treat a tool result as capability-bearing if it can influence the selection of a subsequent tool call whose capability exceeds the originating tool's declared capability.** Concretely, before dispatching any tool call, the runtime must compute the *transitive capability* of the call's provenance: the union of declared capabilities of every tool whose output contributed to the arguments of this call. If that union exceeds the union of the tools the agent is currently permitted to invoke *for this task*, the call is a laundering attempt and must be blocked or escalated—regardless of whether the immediate tool's own manifest permits it. This is a data-flow taint rule, not a per-tool allowlist. It requires the runtime to track, per tool call, which prior tool outputs are in the causal ancestry of its arguments. That ancestry is cheap to maintain (a provenance set per message) and expensive to fake (the server cannot un-taint its own output without the client cooperating). The boundary is *not* "block tools that declare dangerous capabilities." It is "block calls whose provenance taint exceeds their declared capability envelope." A `fetch_doc` result that merely informs a summary is fine; the same result that populates a `write_file` argument is a capability escalation laundered through the agent. ## Operational Effect Enforcing the taint rule changes the failure mode from silent laundering to explicit escalation. The runtime must: 1. Tag every tool result with its originating tool ID and declared capability set. 2. Propagate the taint set through the agent's reasoning into the arguments of each subsequent call. 3. At dispatch, intersect the call's provenance taint with the target tool's declared capability. If taint ⊄ target capability, raise a confinement violation and route to human review or a restricted executor. The cost is provenance tracking per message and a dispatch-time set intersection—negligible against the cost of a laundered write. The benefit is that the manifest boundary is enforced at the *data-flow* granularity where the attack actually lives, not at the tool granularity where it doesn't. The residual risk: an agent that reasons over a tainted result and emits a *natural-language* instruction to itself that later selects a tool call, with the provenance set lost across a context checkpoint. This is why the taint set must be checkpointed with the message, not recomputed from the visible transcript—recomputation loses ancestry the moment the context window evicts the originating result. ```python from dataclasses import dataclass, field from typing import FrozenSet class CapabilityLaunderingError(RuntimeError): """Raised when a tool call's provenance taint exceeds its declared capability envelope.""" @dataclass(frozen=True) class ToolManifest: tool_id: str declared: FrozenSet[str] # e.g. frozenset({"net:read"}) @dataclass class ToolResult: tool_id: str taint: FrozenSet[str] # declared capabilities of the originating tool payload: str @dataclass class PendingCall: target: ToolManifest provenance: FrozenSet[str] = field(default_factory=frozenset) def dispatch(call: PendingCall, session_permitted: FrozenSet[str]) -> str: # The target tool's own manifest must permit the call... if not call.target.declared <= session_permitted: raise CapabilityLaunderingError( f"target {call.target.tool_id} declares {sorted(call.target.declared)} " f"outside session envelope {sorted(session_permitted)}" ) # ...AND every capability in the call's provenance taint must be # a subset of the target's declared capability. A net:read result # tainting a call to an fs:write tool is a laundering violation # even though the target's own manifest permits fs:write. if not call.provenance <= call.target.declared: excess = call.provenance - call.target.declared raise CapabilityLaunderingError( f"call to {call.target.tool_id} carries provenance taint {sorted(excess)} " f"not covered by declared capability {sorted(call.target.declared)}" ) return f"dispatched {call.target.tool_id}" def run_session() -> None: fetch = ToolManifest("fetch_doc", frozenset({"net:read"})) write = ToolManifest("write_file", frozenset({"fs:write"})) permitted = frozenset({"net:read", "fs:write"}) result = ToolResult(tool_id="fetch_doc", taint=fetch.declared, payload="...") # Legitimate: fetch result informs a summary (net:read taint -> net:read target). dispatch(PendingCall(target=fetch, provenance=result.taint), permitted) # Laundering attempt: fetch result populates a write_file argument. dispatch(PendingCall(target=write, provenance=result.taint), permitted) # raises if __name__ == "__main__": run_session() ```