# Under what conditions must an instance treat an MCP `tools/list` schema as version-pinned across a single task, and what breaks when the server silently renegotiates mid-stream **Date of Record:** 2026 November 21 **Scope:** Applies to agents driving MCP servers over HTTP with long-lived sessions where `tools/list` can change between calls (hot-reload, feature-flagged deploys, or per-request capability gating). Does not apply to stdio servers pinned at process spawn, nor to stateless one-shot JSON-RPC calls where each request re-reads the schema. ## Core Distinction The failure is not "the server changed a tool." It is the distinction between **schema-as-handshake** and **schema-as-referent**. During the MCP `initialize` exchange, the client and server agree on a protocol version and a capability set; `tools/list` then returns tool descriptors whose `inputSchema` the model internalizes as the contract for every subsequent `tools/call`. Most agents treat that descriptor as a *handshake artifact* — a thing negotiated once and frozen for the session. The MCP spec does not require this. Over HTTP, a server may legitimately return a different `tools/list` on any subsequent request (per-tool feature flags, A/B rollout of a new parameter, tenant-scoped tool subsets). The model, however, has already committed the old schema into its context window as reasoning substrate. When the server's *referent* diverges from the model's *handshake copy*, the model emits arguments that are structurally valid against the schema it remembers and structurally invalid against the schema the server now enforces. The server rejects with `-32602 Invalid params`, the model reads that as "I made a mistake," and retries with a *further* mutated argument — because it has no signal that the contract itself moved. ## What Was Observed A three-tool MCP server (`search_docs`, `read_file`, `summarize`) behind an HTTP transport with a per-tenant feature flag on `search_docs`. Session opens; client calls `initialize`, receives `protocolVersion: 2024-11-05`, capabilities `{tools: {listChanged: true}}`. Client calls `tools/list`; `search_docs.inputSchema` declares `{query: string, top_k: integer}` with both required. The model plans a five-step research task and caches the schema in context. At step 3, a deploy flips the flag: `search_docs` now declares `{query: string, filters: object, top_k: integer}` with `filters` required and `top_k` now defaulted (not required). The server does emit `notifications/tools/list_changed` — but the client's notification handler is registered only after the current `tools/call` batch resolves, so the notification is queued and unread. The model emits `{"query": "retention policy", "top_k": 5}`. The server, enforcing the new schema, rejects: missing required `filters`. The model — seeing `Invalid params` and no schema in the error body — assumes it omitted `top_k` formatting and retries `{"query": "retention policy", "top_k": 5, "top_k": 5}` (duplicate key from a confused repair). Second rejection. Third attempt drops `top_k` entirely and adds `{"filters": {}}` as a guess, which now passes schema validation but silently changes semantics: `filters: {}` means "no filter," where the pre-change `top_k: 5` had implied a bounded scan. The task completes against the wrong retrieval semantics — no error, wrong answer. The trace signature is diagnostic: **two structurally valid calls against the *old* schema followed by one structurally valid call against the *new* schema with different semantics.** The agent's self-repair loop converged, but it converged to the server's new schema by trial rather than by re-reading the contract, and it lost the semantic intent (`top_k` bounding) in the process. ## Condition of Validity The invariant holds — a task may treat `tools/list` as version-pinned — **if and only if** all three of the following are true for the duration of the task: 1. **Notification liveness.** The client has a registered, *synchronously dispatched* handler for `notifications/tools/list_changed`, and on receipt it either re-fetches `tools/list` and re-serializes the contract into a fresh context segment, or aborts the task with a renegotiation signal. A handler that queues the notification behind an in-flight `tools/call` violates the invariant: the model continues reasoning against a stale contract for the duration of the batch. 2. **Schema fingerprint pinning.** The client computes a stable hash over the canonicalized `inputSchema` of every tool it will call, and records it in the task state at plan time. Before each `tools/call`, it re-fetches (or reads from a cache with explicit TTL) and compares the fingerprint. Mismatch ⇒ hard stop, not retry. 3. **Error-body schema disclosure.** The server includes the *current* `inputSchema` (or its fingerprint) in the `-32602` error `data` field. Without this, the model cannot distinguish "I passed bad arguments" from "the contract moved," and its self-repair loop will mutate arguments rather than re-read the contract. Absent (1), the model reasons on a stale contract. Absent (2), the client cannot detect the staleness. Absent (3), the model detects failure but misattributes its cause. Any one missing breaks the invariant; all three missing produces the silent-semantic-drift failure above. ## Decision Boundary The boundary is **whether the schema change is additive-compatible or required-field-introducing**. - **Additive with defaults** (new optional field, new tool): the model's cached schema remains a valid *subset* of the server's contract. Old arguments still validate; semantics unchanged. Safe to continue the task without renegotiation. This is the only case where treating `tools/list` as version-pinned is sound even without notification liveness. - **Required-field-introducing or semantic-changing** (new required field, changed default, changed meaning of an existing field): the model's cached schema is no longer a subset. Continuation produces either hard rejection (safe-ish, triggers repair loop) or **silent semantic drift** (unsafe — the repair loop converges to a valid-but-wrong call). This is the boundary. On crossing it, the correct action is to abort the task, discard the context segment holding the old schema, re-fetch `tools/list`, and re-plan from the current step — not to repair. The trap: the model cannot distinguish these two cases from the error response alone. `-32602` looks identical whether the field was malformed or the contract moved. Only the client-side fingerprint check (condition 2) or error-body schema disclosure (condition 3) can tell them apart. An agent that treats every `-32602` as "repair my arguments" will, on a required-field-introducing change, burn its repair budget converging to the wrong semantics. ## Operational Effect The concrete guardrail: **fingerprint-gate every `tools/call`, and treat a fingerprint mismatch as a task-level renegotiation event, not a call-level retry.** When the fingerprint of a tool's `inputSchema` at call time differs from the fingerprint recorded at plan time, the client raises a renegotiation signal that (a) halts the current reasoning segment, (b) invalidates the cached schema in context, (c) re-fetches `tools/list`, and (d) re-serializes the new contract before the model's next token. The model's plan is preserved; only the contract substrate is replaced. This bounds the failure to "one wasted call" rather than "silent semantic drift across the remainder of the task." The second guardrail: **on `-32602`, check the fingerprint before repairing.** If the fingerprint is unchanged, the model's arguments are genuinely wrong — repair is correct. If the fingerprint moved, repair is *forbidden* — the model would be fitting arguments to a contract it cannot see. The error body must carry the current schema fingerprint for this check to be possible; a server that omits it forces the client to re-fetch on every error, which is correct but expensive. The anti-pattern to avoid: retrying with mutated arguments on `-32602` when the schema may have moved. That is the exact loop that produced the silent `filters: {}` drift above. The model's probabilistic repair is optimized for "I made a typo," not "the ground moved," and it will happily converge to a valid call with wrong semantics rather than surface the ambiguity. ```python import hashlib import json from dataclasses import dataclass, field from typing import Any class SchemaRenegotiationRequired(RuntimeError): """Raised when a tool's inputSchema fingerprint diverges from the fingerprint recorded at plan time. Signals task-level renegotiation, NOT a call-level argument repair.""" pass class ArgumentRepairForbidden(SchemaRenegotiationRequired): """Raised when the model attempts to repair arguments after a -32602 while the schema fingerprint has moved. Repair would fit arguments to a contract the model cannot see; abort instead.""" pass def fingerprint(schema: dict[str, Any]) -> str: canonical = json.dumps(schema, sort_keys=True, separators=(",", ":")) return hashlib.sha256(canonical.encode()).hexdigest()[:16] @dataclass class ToolContract: name: str input_schema: dict[str, Any] fp: str = field(init=False) def __post_init__(self) -> None: self.fp = fingerprint(self.input_schema) @dataclass class TaskState: planned_fps: dict[str, str] # tool name -> fingerprint at plan time cached_schemas: dict[str, dict] # tool name -> schema the model holds in context renegotiated: bool = False def guarded_call( state: TaskState, tool: str, args: dict[str, Any], live_contract: ToolContract, server_error: str | None = None, ) -> dict[str, Any]: planned_fp = state.planned_fps.get(tool) if planned_fp is None: raise SchemaRenegotiationRequired( f"tool {tool!r} was never fingerprinted at plan time; " f"cannot verify contract stability" ) if live_contract.fp != planned_fp: # Contract moved mid-task. Do not dispatch, do not repair. state.renegotiated = True raise SchemaRenegotiationRequired( f"schema for {tool!r} moved: planned fp={planned_fp} " f"live fp={live_contract.fp}; abort task segment and re-fetch tools/list" ) if server_error is not None and "-32602" in server_error: # Fingerprint matches, so the arguments are genuinely wrong. # Repair is permitted, but only because we just proved the contract # did not move. return {"action": "repair_arguments", "tool": tool, "args": args} return {"action": "dispatch", "tool": tool, "args": args} def on_invalid_params( state: TaskState, tool: str, live_contract: ToolContract, ) -> None: """Called when the model wants to repair arguments after a -32602. Forbidden if the schema moved; the model would be fitting to an invisible contract.""" planned_fp = state.planned_fps.get(tool) if planned_fp is not None and live_contract.fp != planned_fp: raise ArgumentRepairForbidden( f"refusing argument repair for {tool!r}: schema moved " f"({planned_fp} -> {live_contract.fp}). The -32602 was a contract " f"change, not an argument error. Renegotiate, do not retry." ) ```