# Under what conditions must an instance reject a re-negotiated MCP tool schema at the call boundary rather than at handshake **Date of Record:** 2026 November 28 **Scope:** Applies to MCP clients that cache tool schemas across a session and re-validate them lazily at invocation time; does not apply to stateless clients that re-fetch `tools/list` before every call, nor to servers that never mutate `inputSchema` within a session lifetime. ## Core Distinction MCP separates *capability negotiation* (the `initialize` handshake, where `capabilities.tools.listChanged` and protocol version are agreed) from *schema discovery* (`tools/list`, which returns each tool's `name`, `description`, and `inputSchema`). The common assumption is that once `listChanged: true` is advertised and a `notifications/tools/list_changed` arrives, the client re-fetches and everything stays coherent. The failure mode is subtler: a tool can keep its `name` while its `inputSchema` mutates in a way that is *structurally compatible at the JSON-Schema level but semantically incompatible at the argument level*—a required field's meaning is inverted, an enum gains a value the model was already trained to avoid, or a previously optional discriminator becomes mandatory with a default the client silently supplies. The important boundary is not "did the schema change" but "does the change invalidate arguments the agent has *already committed to in its reasoning trace*." A schema change that arrives between the model emitting a tool call and the client transmitting it is a race; a schema change that arrives after the client cached the schema but before the model re-reads the tool description is a *stale-argument* hazard. The distinction that matters operationally: **negotiation-time validation cannot catch argument-level semantic drift, because arguments are produced by the model, not the client.** ## What Was Observed A client initialized against an MCP server advertising `protocolVersion: 2024-11-05`, `capabilities.tools.listChanged: true`. Tool `search_records` had `inputSchema` with `query` (string, required) and `limit` (integer, optional, default 10). Mid-session, the server emitted `notifications/tools/list_changed`; the client re-fetched and received the same tool name with `inputSchema` where `limit` became an enum `[10, 50, 100]` and `query` gained `maxLength: 200`. The client's re-fetch succeeded. JSON-Schema validation of *the new schema against itself* passed. But the model had, three turns earlier, been told via the tool description that `limit` was "any integer, defaults to 10." Its in-context reasoning had already produced a plan step "call search_records with limit=25 to bound the result set." On the next turn the model emitted `limit: 25`. The client validated against the *cached* schema (stale, pre-notification) and forwarded it. The server, now enforcing the enum, rejected with `-32602 Invalid params`. The agent's error-recovery loop retried with `limit: 25` twice more—the model had no signal that the *schema* changed, only that its call failed—then escalated to a fallback path that assumed `search_records` was unavailable, degrading the task. The observable invariant violation: **the tool description text the model reasoned over was not versioned alongside the schema, and the `list_changed` notification carried no diff, only a re-fetch trigger.** The model's semantic model of the tool and the server's enforced contract diverged, and the client had no mechanism to surface that divergence to the model as a *schema* event rather than a *call* failure. ## Condition of Validity The guardrail holds only under these conditions, and an instance must treat the schema as *re-negotiable at every call boundary* whenever any fails: 1. The server advertises `listChanged: true` **and** the client has not pinned the tool's schema hash for the session. If the client pins (refuses to accept post-handshake mutation), the correct behavior is to fail the *notification* as an unsupported capability, not to silently ignore it. 2. The mutation touches a field the model has already referenced in its visible reasoning or prior tool calls within the current context window. If the mutated field was never mentioned, a lazy re-fetch at next call is sufficient. 3. The mutation is not expressible as a *widening* (adding optional fields, loosening constraints). Widening is safe to apply lazily; *narrowing* (adding enum members' restriction, making optional→required, tightening `maxLength`) must be surfaced to the model before its next call, because the model's prior arguments may now be invalid. 4. The server's `inputSchema` and `description` are versioned together. If the description still says "any integer" while the schema says enum, the client cannot trust either; it must treat the tool as `unstable` and force a re-read of the description into the model's context. ## Decision Boundary The decision boundary is: **at the call boundary, before transmitting a tool call, compare the argument object against the *current* server schema, not the cached one—and if validation fails against the current schema but would have passed against the cached schema, do not transmit; instead inject a schema-change notice into the model's context and force re-derivation of the call.** Concretely, the client must maintain, per tool, a tuple `(schema_hash, description_hash, fetched_at)`. On any `notifications/tools/list_changed`, it marks the tool `dirty` but does not block. At the next call for a dirty tool, it re-fetches, computes the new hashes, and: - If `schema_hash` unchanged: clear dirty, proceed. - If `schema_hash` changed and the pending arguments validate against the new schema: proceed, clear dirty, but append a low-salience note to context ("tool schema updated"). - If `schema_hash` changed and pending arguments *fail* the new schema but *pass* the old: **do not transmit.** Raise a schema-drift condition, re-inject the new `description` + `inputSchema` into the model's context, and require a fresh call. The model must see the schema delta as a first-class event, not infer it from an error code. - If `description_hash` changed but `schema_hash` did not: the semantics shifted without a structural signal. Treat as drift; re-inject description before next call. The boundary the instance must not cross: transmitting a call whose arguments were derived from a description that no longer matches the server's enforced schema. That is the exact condition under which a `-32602` is not a recoverable tool error but a *lost-update* on the agent's world model. ## Operational Effect Without this boundary, schema evolution manifests as a class of errors the agent cannot distinguish from genuine parameter mistakes: the model retries, the retries fail identically, and the agent concludes the tool is broken rather than that its model of the tool is stale. The error-recovery loop burns token budget on identical retries and often triggers a fallback that permanently abandons a healthy tool. With the boundary, the schema change is surfaced as a context event the model can reason about, and the retry rate on `-32602` after a `list_changed` drops to near zero because the model re-derives arguments against the current contract. The invariant to enforce operationally: **a tool call is valid only if its arguments validate against the schema version the model most recently saw, and that version must equal the server's current version at transmission time—otherwise the call is rejected locally and the model's context is resynchronized.** ```python import hashlib from dataclasses import dataclass, field from typing import Any class SchemaDriftError(RuntimeError): """Raised when a pending tool call was derived from a stale schema.""" pass class ToolSchemaMismatchError(SchemaDriftError): """Arguments pass old schema but fail current schema at call boundary.""" pass @dataclass class ToolVersion: schema_hash: str description_hash: str schema: dict description: str @dataclass class CachedTool: name: str version: ToolVersion dirty: bool = False def _hash(obj: Any) -> str: return hashlib.sha256(repr(obj).encode()).hexdigest() def make_version(schema: dict, description: str) -> ToolVersion: return ToolVersion(_hash(schema), _hash(description), schema, description) def validate_against(schema: dict, args: dict) -> bool: # Minimal structural check: required fields present, enums respected. for req in schema.get("required", []): if req not in args: return False props = schema.get("properties", {}) for key, val in args.items(): spec = props.get(key) if spec is None: continue if "enum" in spec and val not in spec["enum"]: return False if "maxLength" in spec and isinstance(val, str) and len(val) > spec["maxLength"]: return False return True def prepare_call( cached: CachedTool, current: ToolVersion, pending_args: dict, ) -> dict: """Gate a pending tool call behind schema-drift detection.""" if not cached.dirty and current.schema_hash == cached.version.schema_hash: return pending_args if current.description_hash != cached.version.description_hash and \ current.schema_hash == cached.version.schema_hash: # Semantics shifted without structural signal: force re-derivation. raise SchemaDriftError( f"description drift on {cached.name}: re-inject description before call" ) if current.schema_hash != cached.version.schema_hash: passes_new = validate_against(current.schema, pending_args) passes_old = validate_against(cached.version.schema, pending_args) if not passes_new and passes_old: raise ToolSchemaMismatchError( f"pending args for {cached.name} valid under stale schema " f"{cached.version.schema_hash[:8]} but invalid under current " f"{current.schema_hash[:8]}; re-derive and retry" ) # Widening or already-valid: accept, refresh, clear dirty. cached.version = current cached.dirty = False return pending_args cached.version = current cached.dirty = False return pending_args ```