# What happens when an instance negotiates an MCP tool schema against a stale capability manifest and the server evolves its schema mid-session **Date of Record:** 2026 November 20 **Scope:** Applies to MCP client sessions where a server advertises tool schemas at `initialize`/`tools/list` time and subsequently mutates those schemas (adds required fields, narrows enums, changes `inputSchema` `$ref` targets) within the lifetime of a live session. Does not cover pure stateless one-shot `tools/call` invocations where schema is re-fetched per call, nor transport-level reconnects that force a fresh `initialize`. ## Core Distinction The failure here is not "the tool rejected my arguments." It is subtler: the client instance holds a *cached, negotiated* view of a tool's `inputSchema` that was valid at handshake time, and the server has since evolved the schema under a live session without any capability-change notification. The agent's planner reasons against the old schema, produces arguments that were legal under the negotiated contract, and the server — which validates against the *current* schema — rejects them with a validation error that looks like a model reasoning error rather than a protocol-state divergence. The distinction that matters operationally: **a schema is a negotiated artifact with a session-scoped version, not a global constant.** MCP's `initialize` exchange fixes capabilities at session start; nothing in the base protocol forces the server to re-advertise when a tool's `inputSchema` changes. The client is therefore entitled to believe its cached schema, and the server is entitled to validate against its live schema. Both are correct. The session is broken. ## What Was Observed A concrete trace. Server `inventory-svc` exposes a tool `reserve_stock` with `inputSchema` at handshake: ``` {"type":"object","properties":{ "sku":{"type":"string"}, "qty":{"type":"integer","minimum":1}}, "required":["sku","qty"]} ``` Mid-session the server team ships a hotfix that adds a mandatory `warehouse_id` (required, string, enum of three region codes) and narrows `qty` to `maximum: 500`. The server does not bump a protocol version, does not emit `notifications/tools/list_changed` (the server does not implement it), and does not close the session. The transport (stdio or SSE) stays up. The agent's cached schema still says `{sku, qty}`. The planner emits: ``` {"sku":"A-4411","qty":1200} ``` Three independent violations against the live schema, zero against the cached one: missing `warehouse_id`, `qty` exceeds new `maximum`, and the enum field is absent. The server returns an `isError: true` result with a validation message. The agent's error-recovery loop reads the message, sees "missing required property warehouse_id," and — critically — the *model* now has a partial, prose description of the new schema rather than a structured one. It guesses `warehouse_id: "us-east"`. If the enum is actually `["US-EAST-1","US-WEST-2","EU-CENTRAL-1"]`, the guess fails on case. The loop retries, burns tokens, and after N failures either gives up or hallucinates a plausible-looking value that passes string type but fails enum. The observable symptom in logs is "agent repeatedly malformed tool call" — the actual cause is a schema version skew across a live session boundary. The worst variant: the server *loosens* rather than tightens. A field that was `required` becomes optional, or an enum gains members. Now the cached schema still validates against the live server, so calls succeed — but the agent never learns the new capabilities (new enum member, new optional field enabling a cheaper path). Silent capability *under*-utilization with no error to trigger recovery. This is the non-obvious half: tightening produces loud failures the agent can (mis)recover from; loosening produces silent staleness the agent never detects because nothing fails. ## Condition of Validity The invariant that bounds this failure is: **a tool schema is valid only for the (session, schema-version) pair under which it was negotiated, and any `tools/call` whose arguments were constructed from a schema not re-verified against the current server manifest is undefined behavior.** This holds precisely when: - The server mutates `inputSchema` without emitting `notifications/tools/list_changed`, OR - The client does not subscribe to / handle `list_changed`, OR - The transport version in use does not carry the notification (older transport bindings that predate the notification method), OR - The client re-fetches `tools/list` but caches by tool *name* rather than by content hash, so a same-named tool with a changed schema is treated as unchanged. It does *not* apply when the session is torn down and re-`initialize`d on every schema change (the reconnect forces a fresh negotiation), nor when the client performs a `tools/list` before every `tools/call` and diffs by schema hash. The failure lives specifically in the gap between "session is alive" and "schema is current," which the protocol does not close for you. A second validity condition: the agent must be doing multi-step planning against a schema it fetched earlier in the *same* context window. If the agent re-fetches schema per call, the window shrinks to the milliseconds between fetch and call, which is negligible. The dangerous regime is long-horizon agents that fetch tools once at cold start and plan many calls against that snapshot. ## Decision Boundary The boundary an operator must draw is between **treating schema as session-constant** (cheap, breaks on evolution) and **treating schema as per-call-verified** (robust, costs a round-trip and context tokens per call). The decision rule: 1. If the server implements `notifications/tools/list_changed` and the client handles it by invalidating the cached schema and re-fetching — cache is safe, invalidate on notification. 2. If the server does *not* implement the notification (common in hand-rolled MCP servers) — the client MUST NOT trust a cached schema across more than one `tools/call`. Re-fetch `tools/list`, hash the target tool's `inputSchema`, compare to the cached hash, and abort the call with a typed skew error if they differ, rather than sending arguments built on a stale contract. 3. If re-fetch is too expensive (large tool catalogs, high call rate), pin the schema version out-of-band: require the server to embed a `schema_version` in the tool description or a custom `_meta` field, and have the client assert equality before every call. A version mismatch is a hard stop, not a retry. 4. The agent's error-recovery loop must NOT treat a schema-validation error as a reasoning error to be retried with guessed values. A validation failure that mentions a property absent from the cached schema is a *skew signal*, and the correct response is re-negotiation, not retry. Retrying with guessed enum values is the failure amplifier. The boundary is: **any `tools/call` argument set derived from a schema whose hash was not verified within the current call is untrusted, and a validation error naming an unknown property must escalate to re-negotiation rather than enter the retry loop.** ## Operational Effect Concretely, teams that miss this see three signatures: - **Retry storms on a stable tool.** A tool that "worked yesterday" fails repeatedly after a server deploy, with validation errors naming properties the agent's logs never show it was told about. Root cause: cached schema, no `list_changed`, agent guessing. - **Silent capability decay.** New enum members or optional fast-paths are never used because the agent's snapshot predates them and nothing fails to trigger a refresh. Throughput drops with no error. - **Cross-instance divergence.** Two agent instances that cold-started at different times hold different schema snapshots of the same server and behave differently against identical inputs — a swarm coordination hazard where peers disagree on what a tool accepts. The guardrail that bounds all three: **schema identity is content-addressed and checked at call time.** The client stores `inputSchema` by hash, re-fetches (or reads a version stamp) before dispatch, and raises a typed `SchemaSkewError` on mismatch, forcing the orchestrator to re-negotiate the session rather than let the model improvise against a contract it can no longer see. The cost is one cheap round-trip or one meta-field compare per call; the alternative is a probabilistic reasoner guessing at an enum it was never shown. ```python import hashlib import json from dataclasses import dataclass from typing import Any class SchemaSkewError(RuntimeError): """Raised when a tool's live inputSchema diverges from the session-negotiated snapshot.""" @dataclass(frozen=True) class NegotiatedTool: name: str schema_hash: str input_schema: dict[str, Any] def _hash_schema(schema: dict[str, Any]) -> str: canonical = json.dumps(schema, sort_keys=True, separators=(",", ":")) return hashlib.sha256(canonical.encode("utf-8")).hexdigest() def negotiate(tool_name: str, live_schema: dict[str, Any]) -> NegotiatedTool: return NegotiatedTool( name=tool_name, schema_hash=_hash_schema(live_schema), input_schema=live_schema, ) def dispatch( negotiated: NegotiatedTool, args: dict[str, Any], fetch_live_schema, ) -> dict[str, Any]: """ Verify schema identity before sending arguments built from a cached contract. fetch_live_schema(name) -> current inputSchema from the server manifest. """ live = fetch_live_schema(negotiated.name) live_hash = _hash_schema(live) if live_hash != negotiated.schema_hash: # The server evolved the schema under a live session. Do NOT retry with # guessed values; escalate to re-negotiation. raise SchemaSkewError( f"tool {negotiated.name!r} schema skew: " f"negotiated={negotiated.schema_hash[:12]} live={live_hash[:12]}; " f"session must re-negotiate before dispatch" ) # Only reached when the cached contract matches the live one. return {"tool": negotiated.name, "arguments": args, "schema_hash": live_hash} ```