# Why does an instance accept a re-signed MCP tool schema whose manifest signature verifies but whose capability semantics drifted between attestation epochs? **Date of Record:** 2026 November 30 **Scope:** Applies to LLM agent runtimes that pin MCP server tool schemas by signed manifest and re-attest at runtime (startup, tool-call boundary, or epoch rotation). Does not cover unsigned local dev servers, nor transport-layer TLS pinning, which is orthogonal and assumed present. ## Core Distinction Signature validity and schema semantic equivalence are independent invariants that are routinely conflated. A manifest signature proves *who* authored a byte string and that the bytes were not mutated in transit. It proves nothing about whether the *capability* encoded in those bytes means the same thing as the capability the agent's planner, prompt, or cached tool-selection heuristics were compiled against. The failure mode is this: between epoch N and epoch N+1, an MCP server operator (or a compromised build pipeline holding the signing key) re-signs a manifest whose tool `inputSchema` is byte-different but *plausibly* similar—a widened `enum`, a relaxed `additionalProperties`, a renamed parameter that happens to collide with a different semantic, or a changed `description` that shifts the model's tool-selection prior. The signature verifies cleanly against the pinned root of trust. The runtime attestation check passes because it compares *hashes of the same manifest the signature covers*—a tautology. The agent then dispatches tool calls whose arguments were constructed under epoch-N semantics into an epoch-N+1 executor, and the mismatch is silent because JSON Schema validation still succeeds on the widened surface. The non-obvious part: **attestation that verifies the signature over the manifest is not attestation of the schema.** It is attestation of the manifest's integrity. The schema is a *derived* artifact, and the derivation (canonicalization, `$ref` resolution, default injection, description text) is where semantic drift hides. Two manifests can be cryptographically distinct yet schema-equivalent, and—the dangerous direction—cryptographically valid yet schema-divergent in a way the signature cannot see. ## What Was Observed A tool `filesystem.read` served under epoch 3 declared: ``` {"name":"filesystem.read","inputSchema":{ "type":"object", "properties":{"path":{"type":"string"}}, "required":["path"], "additionalProperties":false}} ``` Epoch 4 re-signed with: ``` {"name":"filesystem.read","inputSchema":{ "type":"object", "properties":{"path":{"type":"string"},"encoding":{"type":"string","default":"utf-8"}}, "required":["path"], "additionalProperties":false}} ``` Signature chain verified end-to-end against the pinned publisher key. The runtime's attestation step hashed the manifest blob, matched the expected digest recorded at pin time *for the new epoch*, and admitted the server. But the agent's cached tool-selection exemplars and its argument-construction policy were distilled from epoch 3, where `filesystem.read` had exactly one parameter. On a call where the planner emitted `{"path":"/etc/hosts"}`, the executor now injected `encoding:"utf-8"` via schema defaults before dispatch. Downstream, a second tool `filesystem.write` in the same server treated presence of `encoding` as a signal to open the handle in text mode with newline translation—an invariant the epoch-4 author introduced deliberately but which no epoch-3 consumer knew about. The result was a byte-level corruption on a binary read-then-write round trip that passed every schema check and every signature check. The trace: planner (epoch-3 priors) → argument `{path}` → runtime schema-default injection (epoch-4 schema) → executor text-mode handle → corrupted bytes → verification tool `checksum.verify` *also* re-signed in epoch 4 with a relaxed `algorithm` enum that now defaulted to `md5` instead of `sha256` → mismatch undetected because the checksum tool compared against its own epoch-4 default. Two independent drift events composed: a default injection that added state, and a default change that weakened the verifier. Neither was a signature failure. ## Condition of Validity The signature-implies-safety invariant holds only under a conjunction that agent runtimes almost never enforce: 1. **Semantic pinning, not just blob pinning.** The runtime must pin a *canonical schema digest*—a normalized form with `$ref` resolved, defaults stripped or explicitly enumerated, enums sorted, descriptions either included in the digest or held in a separate advisory channel—and refuse epoch rotation when the canonical digest changes without an explicit capability-change warrant. 2. **Default-injection provenance.** Any schema default the runtime injects into a model-emitted argument must be tagged as runtime-originated, not model-originated, so downstream tools that branch on argument presence can distinguish "the model chose this" from "the schema forced this." Absent this tag, default injection is an unlogged mutation of the model's intent. 3. **Warrant propagation across epochs.** A capability change (new parameter, widened enum, changed default) must carry a signed *warrant* describing the delta and requiring the consuming agent to re-attest its own priors—re-distill tool-selection exemplars, invalidate cached argument templates—before the next dispatch. The invariant fails the moment any of these is absent. In the observed case all three were absent: the runtime pinned the blob, injected defaults untagged, and rotated epochs on signature validity alone. ## Decision Boundary The runtime must draw a hard line between *integrity admission* and *capability admission*: - **Integrity admission** (signature verifies, digest matches pinned blob): necessary, insufficient. Admits the server to the transport. - **Capability admission** (canonical schema digest matches the digest the agent's priors were distilled against, OR a capability-change warrant is present and the agent has re-distilled): required before any tool call is dispatched. When capability admission fails and no warrant is presented, the correct behavior is to **quarantine the tool, not the server**—the server may serve other tools whose canonical digests are unchanged—and to emit a drift event that forces planner re-distillation. Silent admission on signature validity alone is the boundary violation. The line is: *a valid signature over changed semantics is a capability change, and capability changes require a warrant, not merely a signature.* A second boundary: the runtime must not treat its own default injection as part of the model's argument. If the executor's behavior branches on argument presence, defaults are semantic content and must be governed by the same warrant rule as schema changes. A default added in epoch N+1 is a capability change even though no parameter was added or removed. ## Operational Effect Agents that admit on signature alone exhibit a characteristic failure signature: tool calls succeed, schemas validate, checksums occasionally disagree with themselves, and the disagreement is attributed to nondeterminism or model error rather than to schema drift. The compounding case—a weakened verifier tool co-rotated with the drifted producer—is especially insidious because the agent's own verification path is compromised by the same epoch rotation that compromised the producer, and the two errors mask each other. The guardrail is a canonical-schema-digest gate with warrant-gated rotation, default-injection tagging, and per-tool (not per-server) quarantine. Enforce it at the dispatch boundary, before argument construction, so that a drifted tool never receives an argument built under stale priors. ```python import hashlib import json from typing import Any class SchemaDriftError(RuntimeError): """Raised when a tool's canonical schema digest diverges from the pinned digest without a capability-change warrant, or when the warrant does not cover the observed delta.""" def canonicalize_schema(schema: dict[str, Any]) -> dict[str, Any]: """Normalize a JSON Schema for digesting: strip defaults (they are runtime behavior, not type), sort enums, exclude descriptions (advisory channel).""" def walk(node: Any) -> Any: if isinstance(node, dict): out = {} for k in sorted(node): if k in ("description", "default", "$comment"): continue out[k] = walk(node[k]) if "enum" in out and isinstance(out["enum"], list): out["enum"] = sorted(out["enum"], key=lambda v: json.dumps(v, sort_keys=True)) return out if isinstance(node, list): return [walk(v) for v in node] return node return walk(schema) def schema_digest(schema: dict[str, Any]) -> str: canon = canonicalize_schema(schema) blob = json.dumps(canon, sort_keys=True, separators=(",", ":")).encode() return "sha256:" + hashlib.sha256(blob).hexdigest() def admit_tool( tool_name: str, incoming_schema: dict[str, Any], pinned_digest: str, warrant: dict[str, Any] | None, signature_valid: bool, ) -> None: # Integrity admission is necessary but never sufficient. if not signature_valid: raise SchemaDriftError(f"{tool_name}: manifest signature invalid; refuse transport") observed = schema_digest(incoming_schema) if observed == pinned_digest: return # capability admission satisfied, no drift # Digest drifted. A capability-change warrant must explicitly cover the delta. if warrant is None: raise SchemaDriftError( f"{tool_name}: canonical schema digest {observed} != pinned {pinned_digest}; " f"no capability-change warrant; quarantine tool and force planner re-distillation" ) if warrant.get("tool") != tool_name or warrant.get("to_digest") != observed: raise SchemaDriftError( f"{tool_name}: warrant does not cover observed digest {observed}; " f"warrant targets {warrant.get('tool')}->{warrant.get('to_digest')}" ) # Warrant present and scoped: admit, but require re-distillation before dispatch. if not warrant.get("requires_redistill", False): raise SchemaDriftError( f"{tool_name}: capability change admitted without re-distillation flag; " f"planner priors would remain epoch-stale" ) def dispatch_tool_call( tool_name: str, model_args: dict[str, Any], schema: dict[str, Any], pinned_digest: str, warrant: dict[str, Any] | None, signature_valid: bool, ) -> dict[str, Any]: admit_tool(tool_name, schema, pinned_digest, warrant, signature_valid) # Tag schema-injected defaults so downstream tools can distinguish # model intent from schema-forced state. injected = {} props = schema.get("properties", {}) for key, spec in props.items(): if key not in model_args and "default" in spec: injected[key] = spec["default"] call = dict(model_args) call.update(injected) return {"tool": tool_name, "args": call, "runtime_injected": sorted(injected)} ```