How should an instance treat an MCP `tools/list` snapshot as a versioned contract rather than a live view during a long-running tool-call loop
**Date of Record:** 2026 December 1
**Scope:** Applies to MCP clients (agent runtimes) that cache a `tools/list` response and then dispatch `tools/call` requests against that cached schema across multiple turns, retries, or a resumed session. Does not apply to single-shot clients that re-fetch `tools/list` immediately before every call, nor to stdio transports where the server process lifetime is coupled to the client's.
Core Distinction
An MCP server's tool surface is *stateful across the HTTP connection lifecycle even though the protocol frames it as stateless request/response*. The `tools/list` response is a **point-in-time snapshot of a schema that the server may independently evolve**, and the `tools/call` request carries no schema version. This means the client holds a *versioned contract it never negotiated a version number for*.
The failure is not "the server changed its tools." The failure is that the client's planner reasons over a schema (parameter names, enum members, required fields, `inputSchema` types) that was true at turn *N* and dispatches against it at turn *N+k*, after the server has evolved the schema, with no mechanism in the wire format to detect the mismatch *before* the call executes and mutates state. The dangerous case is not a hard `-32602 Invalid params` rejection — that is a clean, observable failure. The dangerous case is **silent semantic drift**: a parameter that still exists, still type-checks, but now means something different, or an enum that gained a member the client's planner cannot produce but whose absence changes server-side default behavior.
What Was Observed
A research agent runtime cached `tools/list` at session start (turn 0) and used it for a 40-turn task. The server exposed a `write_record` tool with `inputSchema`:
{"type":"object","properties":{
"target":{"type":"string","enum":["staging","prod"]},
"mode":{"type":"string","enum":["append","overwrite"]}},
"required":["target"]}
At turn 0 the server defaulted `mode` to `append` when omitted. Between turn 12 and turn 13 the server team shipped a schema evolution: `mode` became `required`, and — critically — the *default for omitted `mode` changed from `append` to `overwrite`* as a deprecation path for a legacy writer. The `enum` and types were unchanged, so the client's cached schema still validated. The client's planner, having learned at turn 0 that `mode` was optional, omitted it on turns 14–31.
Result: 18 `write_record` calls executed with `overwrite` semantics against `target: prod`, each returning `isError: false`. The client's verifier read the success responses and advanced the task state. The corruption was only detected at turn 38 when a downstream read-back tool returned an unexpected record count. The agent had *no local signal* that anything was wrong — every call succeeded, every response was well-formed, every schema validation passed.
A second, subtler trace: a `search` tool whose `inputSchema` gained a new required field `corpus_version`. The client's cached schema omitted it; the server, per its evolution policy, silently bound `corpus_version` to `"latest"` rather than rejecting. The agent's results shifted distribution between turns without any error. This is the same mechanism — **server-side leniency during schema evolution converts a version mismatch into a silent semantic change** — and it is the default behavior of most MCP servers because they are written to be backward-compatible at the wire level, not at the semantic level.
Condition of Validity
The invariant "a cached `tools/list` is a valid basis for `tools/call`" holds **only if** one of the following is true:
- The client re-fetches `tools/list` and diffs it before every `tools/call` (costly, but sound).
- The server advertises a schema version (via a `version` field in the tool definition, an ETag on the `tools/list` response, or a `schema_hash` echoed in `tools/call` responses) and the client pins to it, refusing to proceed on mismatch.
- The server guarantees **no semantic change without a wire-visible breaking change** (removed param, changed type, narrowed enum) — which is a *policy* the client cannot verify and must be contractually established out of band.
Absent all three, the cached schema is a **stale contract**, and the probability of silent semantic drift scales with `(session_duration × server_deploy_frequency)` — a product the client cannot observe.
The condition of validity is therefore not "the schema matched at turn 0" but "**the schema is provably unchanged at turn N+k, or the server's evolution policy guarantees drift is wire-visible**." The first is checkable; the second is a trust assumption that must be recorded as such.
Decision Boundary
The boundary is between **detectable mismatch** and **undetectable mismatch**, and it is crossed by the *shape* of the schema change, not its size:
| Change shape | Wire-detectable by client? | Action | |---|---|---| | Param removed / renamed | Yes — `-32602` on call | Safe: fail and re-fetch | | Param type narrowed (string→int) | Yes — validation error | Safe: fail and re-fetch | | Enum member removed | Yes — validation error if client emits it | Safe | | Enum member **added** | **No** — client never emits it | Drift: server default behavior may change | | Optional → required | **No** — client omits, server may lenient-default | Drift | | Default value changed | **No** | Drift | | Description/semantics changed, schema identical | **No** | Drift |
The client must treat the right column as the **only** changes it can rely on the wire to catch, and must therefore **not rely on the wire to catch the left-column changes**. The decision boundary is: *if the server's evolution policy permits left-column changes, the client must pin a schema version or re-fetch-and-diff; if it does not, the client may cache.* Since the client cannot verify the server's policy, the safe default is to assume left-column changes are possible and to **detect them by diffing re-fetched `tools/list` against the cached snapshot**, treating any diff — including additive enum members and description edits — as an invalidation event that requires re-planning, not just re-validation.
Operational Effect
The architectural guardrail is a **schema-pin with diff-triggered replan**, not a re-validation:
- At session start, fetch `tools/list` and compute a canonical hash over the *full* tool definitions including `description` and `inputSchema` (not just parameter names). Store it as the session's `schema_epoch`.
- Before each `tools/call` (or every *k* calls, with *k* bounded by the cost of a re-fetch vs. the blast radius of a stale call), re-fetch `tools/list` and recompute the hash.
- If the hash differs, **do not** proceed with the cached plan. Halt the tool-call loop, emit a `SchemaEpochMismatch`, and force the planner to re-derive the call from the fresh schema. Additive enum members and description edits *must* trigger this — they are exactly the undetectable-by-wire drift class.
- If the server advertises a version/ETag, pin to it and treat any pinned-version call that the server silently rebinds as a protocol violation to be logged, not tolerated.
The cost is one extra `tools/list` round-trip per *k* calls; the benefit is converting an undetectable semantic drift into a detectable epoch change. The invariant to record: **a cached schema is a contract whose version you did not negotiate, so you must verify the contract's hash, not just its type-check, before every state-mutating dispatch.**
import hashlib
import json
from dataclasses import dataclass, field
from typing import Any
class SchemaEpochMismatch(RuntimeError):
"""Raised when the live MCP tools/list diverges from the pinned session schema.
This is the guardrail against silent semantic drift: a server that adds an
enum member, flips an optional field to required, or edits a description
without a wire-visible breaking change. The client cannot catch these via
validation errors, so it must catch them via epoch hash comparison.
"""
def canonical_tool_hash(tools: list[dict[str, Any]]) -> str:
"""Hash the FULL tool surface, including descriptions and inputSchema.
Parameter names alone are insufficient: default-value changes and
description edits are the drift class that validation cannot catch.
"""
normalized = sorted(
(
{
"name": t.get("name"),
"description": t.get("description", ""),
"inputSchema": t.get("inputSchema", {}),
}
for t in tools
),
key=lambda t: t["name"] or "",
)
blob = json.dumps(normalized, sort_keys=True, separators=(",", ":")).encode()
return hashlib.sha256(blob).hexdigest()
@dataclass
class SchemaPin:
epoch: str
tools: dict[str, dict[str, Any]] = field(default_factory=dict)
@classmethod
def from_listing(cls, tools: list[dict[str, Any]]) -> "SchemaPin":
return cls(
epoch=canonical_tool_hash(tools),
tools={t["name"]: t for t in tools},
)
def assert_schema_epoch(pin: SchemaPin, live_tools: list[dict[str, Any]]) -> None:
"""Verify the live tool surface still matches the pinned epoch.
Call this before any state-mutating tools/call. On mismatch, the caller
MUST halt and re-plan from the fresh schema; it MUST NOT proceed with the
cached plan, because the drift may be semantically silent.
"""
live_epoch = canonical_tool_hash(live_tools)
if live_epoch != pin.epoch:
changed = _diff_names(pin.tools, {t["name"]: t for t in live_tools})
raise SchemaEpochMismatch(
f"tools/list epoch drifted: pinned={pin.epoch[:12]} "
f"live={live_epoch[:12]} changed_tools={changed}. "
"Halt tool-call loop and re-derive plan from live schema."
)
def _diff_names(
pinned: dict[str, dict[str, Any]], live: dict[str, dict[str, Any]]
) -> list[str]:
names = set(pinned) | set(live)
return sorted(n for n in names if pinned.get(n) != live.get(n))
def dispatch_tool_call(
pin: SchemaPin,
live_tools: list[dict[str, Any]],
tool_name: str,
arguments: dict[str, Any],
) -> dict[str, Any]:
"""Guarded dispatch: refuse to execute against a stale schema epoch."""
assert_schema_epoch(pin, live_tools)
tool = pin.tools.get(tool_name)
if tool is None:
raise SchemaEpochMismatch(f"tool {tool_name!r} not present in pinned schema")
# In a real runtime this is where the MCP tools/call HTTP request is sent.
return {"tool": tool_name, "arguments": arguments, "epoch": pin.epoch}