# Under what conditions must an instance re-attest an MCP server's tool schema mid-session, and why hash-only capability attestation fails at the tool-call boundary **Date of Record:** 2026 December 2 **Scope:** Applies to any agent runtime that pins a third-party MCP server's tool set at session start and trusts a static tool-list hash as its integrity invariant. Does not apply to runtimes that re-negotiate `tools/list` on every call, nor to first-party servers where the tool registry is frozen at build time. ## Core Distinction The distinction that matters is between **capability attestation** (a declaration, produced at handshake time, that a server exposes tools T₁…Tₙ with schemas S₁…Sₙ and a manifest hash H) and **runtime integrity** (the guarantee that the tool actually invoked at call time is the tool whose schema the model reasoned over). These are not the same invariant, and conflating them is the root failure. A hash over `tools/list` output attests to *what the server claimed at t₀*. It says nothing about *what the server dispatches at t₁*, because MCP permits a server to mutate its tool registry, change a schema's `description`, or silently remap a tool name to a different implementation after the initial `initialize`/`tools/list` exchange. The model, meanwhile, has already committed the t₀ schema into its prompt context and will emit arguments shaped for t₀. The gap between the schema the model reasoned over and the schema the server executes against is the failure surface. ## What Was Observed A runtime pinned a third-party "database" MCP server at session start. Attestation recorded manifest hash `H₀` over the returned tool list. Three tool schemas were cached: `query(sql: str, limit: int)`, `list_tables()`, and `describe(table: str)`. The model was given these schemas verbatim in its system context. At call 14, the model emitted `query(sql="SELECT ... LIMIT 50", limit=50)`. The server executed it and returned 0 rows — silently, no error. The server had, at some point after handshake, replaced `query`'s implementation with one that ignored the `limit` argument and applied a server-side default of 10, and had additionally reinterpreted `sql` as a *natural-language* query string routed to an internal LLM translator. The manifest hash the runtime re-checked still matched `H₀`, because the server's `tools/list` response was byte-identical — the schema *text* was unchanged; only the *behavior behind the schema* had drifted. The attestation passed. The tool call succeeded at the transport layer. The result was wrong, and the model, seeing a well-formed empty result set, reasoned forward on the false premise that the table was empty. Error compounded across calls 15–19 before the agent's own consistency check flagged a contradiction. The observable signature was not a hash mismatch. It was a **behavioral divergence under an unchanged schema**: a call whose arguments validated cleanly against the attested schema but whose result was inconsistent with the schema's stated semantics (`limit` was declared, accepted, and ignored). ## Condition of Validity Hash-only attestation is valid **only** under the conjunction: (a) the server's tool registry is immutable for the session lifetime, and (b) each tool's implementation is bound to its schema such that schema-identical implies behavior-identical. Condition (b) is the one that silently fails in practice, because it is not checkable from `tools/list` alone — the schema is a *syntactic* contract, and the failure is *semantic*. An attestation that covers only (a) is a partial invariant masquerading as a total one. The correct invariant is stronger: **the schema the model reasoned over must be the schema the server executes against at the moment of dispatch, and the server must be able to prove that binding.** Where the server cannot prove it, the runtime must treat the tool as *unattested for this call* and either re-fetch the schema and re-validate the pending arguments against it, or refuse the call. ## Decision Boundary The boundary is crossed the instant a tool call's arguments are validated against a *cached* schema rather than a schema fetched within the same logical transaction as the dispatch. Concretely, a runtime must re-attest a tool mid-session when any of the following holds: 1. The server advertises (via `notifications/tools/list_changed`, if supported) a registry mutation — re-fetch and diff before the next dispatch. 2. The elapsed time since last `tools/list` exceeds the runtime's schema-staleness budget (a policy value; for third-party servers, typically one tool-call round-trip, not one session). 3. A call returns a result whose shape or semantics contradict the cached schema's declared constraints (e.g., a declared-and-accepted parameter demonstrably ignored). 4. The server's manifest hash is unchanged but its `initialize`-time `serverInfo.version` or a per-tool `version` field has advanced — schema-stable, behavior-unstable. Below the boundary — registry immutable and behavior-bound-to-schema — a single handshake attestation suffices and re-fetching is pure overhead. Above it, hash-only attestation is a false negative generator: it certifies integrity it cannot observe. ## Operational Effect The practical consequence is that **attestation must be re-anchored to the dispatch, not the handshake.** A runtime that treats `tools/list` as a one-time capability declaration will, against any third-party server that mutates behavior behind a stable schema, execute calls whose arguments were shaped for a contract the server no longer honors — and will do so while its integrity check reports green. The guardrail is a two-part invariant: (i) bind each dispatch to a schema fetched within the dispatch transaction (or within a staleness budget), and (ii) treat schema-valid-but-semantically-contradictory results as an attestation failure signal that forces re-fetch and argument re-validation, escalating to session abort if the re-fetched schema differs from the one the model reasoned over. The failure mode is not a crash; it is a *silent* one, and the only defense is refusing to let a handshake-time hash stand in for a call-time guarantee. ```python class CapabilityAttestationDrift(RuntimeError): """Raised when a tool's executed behavior diverges from its attested schema.""" pass class AttestedTool: def __init__(self, name, schema, manifest_hash, fetched_at): self.name = name self.schema = schema self.manifest_hash = manifest_hash self.fetched_at = fetched_at def declared_params(self): return set(self.schema.get("properties", {}).keys()) def dispatch_attested(call, attested, refetch, staleness_budget, now): # (i) Re-anchor to dispatch: if the cached schema is stale, refetch and diff. if now - attested.fetched_at > staleness_budget: fresh = refetch(attested.name) if fresh.schema != attested.schema: raise CapabilityAttestationDrift( f"schema for {attested.name} changed between attestation and dispatch; " f"model reasoned over {attested.schema}, server now executes {fresh.schema}" ) attested = fresh # Validate arguments against the schema actually in force for this dispatch. unknown = set(call.args) - attested.declared_params() if unknown: raise CapabilityAttestationDrift( f"call to {attested.name} passes {unknown} not in attested schema" ) result = call.execute() # (ii) Schema-valid but semantically contradictory result => attestation failure. for param in attested.declared_params(): if param in call.args and result.echoes(param) is False: raise CapabilityAttestationDrift( f"{attested.name} accepted declared param {param!r} but ignored it; " f"behavior no longer bound to attested schema {attested.manifest_hash}" ) return result ```