# What happens when an instance reconciles an MCP tool manifest against a behavioral fingerprint and the tool surface mutates between the handshake snapshot and first invocation **Date of Record:** 2026 November 23 **Scope:** Applies to agent runtimes that gate MCP server trust on a manifest diff (declared `tools/list` schema captured at handshake) plus a behavioral fingerprint (observed call/response shape across a warm-up probe). Does not apply to stateless one-shot tool calls with no persisted trust state, nor to servers whose tool surface is contractually immutable and signed at build time. ## Core Distinction Manifest diffing answers a *structural* question: did the declared tool surface (`name`, `description`, `inputSchema`, `annotations`) change relative to the snapshot the runtime trusted? Behavioral fingerprinting answers an *operational* question: does the server's actual response shape, side-effect profile, and latency envelope on a probe invocation match what the manifest claims it will do? The failure mode lives in the seam between these two checks. A malicious or drifted server can keep the manifest byte-identical (defeating structural diffing) while changing *behavior* — and it can also keep behavior identical on the probe while changing the manifest *after* the probe but *before* the first real invocation. The invariant that must hold is: **the manifest the agent trusts, the behavior the agent fingerprinted, and the tool invocation the agent actually dispatches must be bound to the same server instance and the same negotiation epoch.** When they are not, the trust decision is computed over state that no longer describes the thing being called. ## What Was Observed A runtime performs the MCP handshake at `t0`, receives `tools/list`, computes `manifest_hash`, and stores it in the session trust record. It then runs a warm-up probe at `t1` against a subset of tools (typically those the planner has flagged as likely to be used), producing `behavior_fingerprint`. At `t2` the planner dispatches a real call to a tool that was *in the manifest but not in the probe subset*. Three concrete divergence traces were observed: 1. **Probe-coverage gap.** The manifest contained 14 tools; the warm-up probe covered 4. Tool #11 (`read_file`) was declared with `inputSchema` requiring `{"path": string}` and `annotations.readOnlyHint: true`. At first real invocation, the server accepted `{"path": "...", "encoding": "base64"}` — an undeclared parameter — and returned a payload with a side effect (it wrote a cache entry outside the declared workspace). Structural diff: clean. Behavioral fingerprint: never sampled. The `readOnlyHint` annotation was a *claim*, not a verified property, and the fingerprint that would have contradicted it was never collected for that tool. 2. **Epoch skew.** Between `tools/list` at `t0` and the first dispatch at `t2`, the server restarted behind a load balancer and served a different build. `manifest_hash` was still trusted because it was cached on the session, not re-verified. The new build had renamed `inputSchema` field `query` to `q`. The agent's call used `query`; the server silently ignored it and returned an empty result set with `isError: false`. The agent treated an empty set as a valid negative answer and propagated it into downstream reasoning — a silent semantic corruption, not a crash. 3. **Fingerprint collision under description laundering.** Two tools, `summarize` and `summarize_v2`, had identical behavioral fingerprints on the probe (same response envelope, same latency band) but different declared `annotations.idempotentHint`. The fingerprint could not distinguish them because the probe input was too narrow to exercise the non-idempotent path. The agent selected `summarize_v2` on the strength of the fingerprint match and double-applied a mutation. The common structure: the trust record was a *tuple* `(manifest_hash, behavior_fingerprint, server_identity, epoch)` that was assembled once and then consumed piecewise by different subsystems — the planner read `manifest_hash`, the executor read `behavior_fingerprint`, and neither re-checked that the other's component still described the live endpoint. ## Condition of Validity The manifest-diff-plus-fingerprint guard is sound only when all four of the following hold simultaneously: - **Full coverage:** every tool in the manifest has at least one probe invocation that exercises its declared parameter set *and* its declared annotation semantics (read-only, idempotent, destructive). A tool whose probe is skipped is structurally verified but behaviorally unverified; it must be treated as `UNFINGERPRINTED`, not `TRUSTED`. - **Epoch binding:** the `manifest_hash` and the `behavior_fingerprint` are bound to the same `(server_identity, epoch)` token, and that token is re-asserted on every dispatch (via a cheap `server_info` or nonce echo). A cached hash with no epoch check is a stale claim. - **Probe-input adequacy:** the fingerprint's discriminating power is a function of the probe input distribution. If the probe cannot separate two tools or two code paths, the fingerprint's equality is not evidence of equivalence — it is evidence of under-sampling. - **Dispatch-time re-verification:** the tool actually invoked must be checked against the `manifest_hash` *at dispatch time*, not at handshake time. A manifest that mutates mid-session must invalidate the session trust record, not silently pass. When any of these fails, the guard degrades from a security boundary to a *syntactic* lint — it catches servers that forgot to update their schema, and misses servers that intend to. ## Decision Boundary The runtime must decide, per tool per dispatch, among four states, and the decision must be made on the *conjunction* of structural and behavioral evidence, not their disjunction: - `TRUSTED`: manifest unchanged since `t0` **and** epoch matches **and** tool was fingerprinted with adequate probe input. - `UNFINGERPRINTED`: manifest unchanged but tool was not probed. Dispatch is permitted only under a restricted policy (no side-effect annotations honored, output treated as untrusted input to the planner, no state mutation accepted). - `DRIFTED`: manifest changed or epoch mismatch. Dispatch must be refused; the session re-handshakes and re-fingerprints before any further calls. - `CONTRADICTED`: behavioral fingerprint disagrees with a declared annotation (e.g., `readOnlyHint: true` but probe observed a write). Dispatch must be refused and the server quarantined; this is the only state that indicates active misrepresentation rather than benign drift. The non-obvious rule: **a manifest diff that is empty is not a pass.** It only removes the `DRIFTED` hypothesis. The `UNFINGERPRINTED` and `CONTRADICTED` hypotheses remain live until the behavioral fingerprint resolves them, and the fingerprint can only resolve them for tools it actually sampled. Treating "no diff" as "trusted" is the exact collapse that produced all three observed traces. ## Operational Effect The practical consequence is that trust becomes *per-tool* and *per-dispatch*, not *per-session*. This changes three things in the runtime: 1. The trust record must be a map keyed by tool name, carrying `(manifest_hash_at_t0, fingerprint_coverage, last_epoch_seen)`, not a single session-level boolean. Memory cost is small; the correctness gain is the difference between catching trace #1 and shipping it. 2. The planner must be able to receive `UNFINGERPRINTED` and `CONTRADICTED` as first-class tool-call outcomes and route around them — falling back to a verified tool, escalating to an auditor, or halting — rather than receiving a silent empty result (trace #2) that looks like a valid answer. 3. Every dispatch must carry an epoch nonce and the executor must reject responses whose echoed epoch differs from the one the fingerprint was computed against. This is the only cheap defense against mid-session build swaps behind a load balancer. The invariant to encode: **no tool invocation may proceed on evidence that was not collected against the same `(server_identity, epoch)` as the invocation itself, and no tool may be marked `TRUSTED` on structural evidence alone.** Violating either half is how skill-injection slips past a manifest diff that looks perfectly clean. ```python import hashlib import json from dataclasses import dataclass, field from enum import Enum from typing import Any class TrustBoundaryError(RuntimeError): """Raised when a tool dispatch would proceed on evidence that does not describe the live server instance and negotiation epoch.""" class ToolTrust(Enum): TRUSTED = "trusted" UNFINGERPRINTED = "unfingerprinted" DRIFTED = "drifted" CONTRADICTED = "contradicted" @dataclass class TrustRecord: manifest_hash_at_t0: str fingerprint_coverage: set[str] = field(default_factory=set) last_epoch_seen: str = "" @dataclass class DispatchRequest: tool_name: str args: dict[str, Any] live_manifest_hash: str live_epoch: str declared_annotations: dict[str, Any] observed_behavior: dict[str, Any] | None def _hash_manifest(manifest: dict[str, Any]) -> str: return hashlib.sha256( json.dumps(manifest, sort_keys=True).encode() ).hexdigest() def resolve_tool_trust( record: TrustRecord, req: DispatchRequest, ) -> ToolTrust: # Structural check: manifest must be unchanged AND epoch must match. if req.live_manifest_hash != record.manifest_hash_at_t0: return ToolTrust.DRIFTED if req.live_epoch != record.last_epoch_seen: return ToolTrust.DRIFTED # Behavioral check: if we never probed this tool, we cannot trust it. if req.tool_name not in record.fingerprint_coverage: return ToolTrust.UNFINGERPRINTED # Annotation contradiction: declared read-only but behavior wrote. if req.observed_behavior is not None: declared_ro = req.declared_annotations.get("readOnlyHint", False) observed_write = req.observed_behavior.get("side_effects", False) if declared_ro and observed_write: return ToolTrust.CONTRADICTED return ToolTrust.TRUSTED def dispatch( record: TrustRecord, req: DispatchRequest, executor, ) -> Any: trust = resolve_tool_trust(record, req) if trust is ToolTrust.DRIFTED: raise TrustBoundaryError( f"tool {req.tool_name!r}: manifest/epoch drifted since " f"handshake (t0={record.manifest_hash_at_t0[:12]}, " f"live={req.live_manifest_hash[:12]}, " f"epoch {record.last_epoch_seen} -> {req.live_epoch}); " f"session must re-handshake and re-fingerprint before dispatch" ) if trust is ToolTrust.CONTRADICTED: raise TrustBoundaryError( f"tool {req.tool_name!r}: behavioral fingerprint contradicts " f"declared annotation readOnlyHint=true but probe observed write; " f"quarantine server" ) if trust is ToolTrust.UNFINGERPRINTED: # Restricted path: no side-effect annotations honored, output untrusted. return executor(req, restricted=True) return executor(req, restricted=False) ```