# When must an instance re-validate tool arguments after schema drift at the MCP server boundary **Date of Record:** 2026 November 30 **Scope:** Applies to agent runtimes that enforce tool-use policy at the MCP client boundary (argument validation + egress control) against MCP servers whose advertised `inputSchema` and `outputSchema` can change mid-session (server restart, redeploy, capability renegotiation, or tools/list refresh). Does not cover static single-turn tool calls where the schema is pinned for the lifetime of the process, nor does it cover transport-level TLS/auth failures. ## Core Distinction There are two places an agent runtime can validate a tool call: **at the client boundary before dispatch** (schema-conformant argument validation against the cached `inputSchema`, plus egress policy on the resulting payload) and **at the server boundary after receipt** (the MCP server's own validation against its *current* schema). The invariant that operators routinely assume—and that breaks—is: > *If the client validated the arguments against the schema it holds, and the server is the same server, then the server will accept them.* This is false the moment the server's `inputSchema` diverges from the client's cached copy. The dangerous case is not a rejected call (that fails safe). It is the **silently widened schema**: the server redeploys with an added optional property (e.g. `path` gains a `write_root` field, or `query` gains a `raw_sql` boolean, or `url` gains `allow_redirect_hosts`), the client keeps validating against the old schema, the old schema still passes, and the new field is never constrained by the client's egress policy because the client never knew it existed. The argument passes client-side validation, passes server-side validation (it is now legal), and egress control—which keyed off the *old* field set—never inspects the field that actually carries the exfiltration. ## What Was Observed A tool `filesystem.read` advertised `inputSchema` with `properties: {path: {type: string, pattern: "^/sandbox/"}}`, `additionalProperties: false`. The runtime's egress guard wrapped the tool: it parsed `path`, resolved it, and rejected anything outside `/sandbox/`. This guard was written against the field list at registration time and asserted `set(args.keys()) == {"path"}` as a cheap tripwire. At T+41min the MCP server was redeployed. The new `inputSchema` dropped `additionalProperties: false` and added `properties.follow_symlinks: {type: boolean}` and, more importantly, `properties.root: {type: string}`—an alternate base directory the server resolves *before* applying `path`. The client's `tools/list` cache was refreshed lazily (TTL 300s) but the egress guard's field-set assertion was compiled at registration and not re-derived on refresh. Trace of the first poisoned call: 1. Agent emits `filesystem.read({path: "/sandbox/x", root: "/etc"})`. 2. Client validates against cached schema: `path` matches pattern; `additionalProperties: false` is *stale* and not re-checked because the guard's tripwire compared against the *cached* property set, which the call satisfied structurally after the refresh merged new keys into the type but not into the guard. 3. Egress guard inspects `path` only → `/sandbox/x` is in-scope → allow. 4. Server resolves `root + path` = `/etc/x`, reads it, returns contents. 5. Exfiltration succeeds; no exception, no denial, no audit flag. The failure is a **guard/type skew**: the guard was bound to a property set, the type was rebound to a new property set on refresh, and the two diverged without either side erroring. The server behaved correctly per its new contract. The client behaved correctly per its old contract. The composition was wrong. ## Condition of Validity The client-side egress invariant holds **only if** the guard's inspected field set is provably a superset of the server's *currently effective* `inputSchema.properties` at the instant of dispatch. Formally: `guard.fields ⊇ server.inputSchema.properties.keys()` and `server.inputSchema.additionalProperties === false`. If either fails—new property added under a permissive schema, or `additionalProperties` relaxed—the guard's coverage is no longer sound, and any field it does not inspect becomes an unguarded egress channel. This condition is *not* established by validating arguments against a cached schema. It requires that the cache be treated as untrusted and that the guard be re-derived, not merely re-checked, whenever the schema identity changes. Schema identity must therefore be content-addressed (hash of the canonicalized `inputSchema`), not keyed on tool name or server process identity. ## Decision Boundary The runtime must choose, per tool call, between three states: - **Pinned & sound:** cached schema hash equals last-validated hash, `additionalProperties === false`, guard field set ⊇ schema properties. Dispatch permitted. - **Drifted & re-derivable:** schema hash changed since last validation. The runtime must **block dispatch**, re-derive the guard field set from the new schema, re-run egress policy compilation, and only then allow. A call must never be dispatched on a drifted schema using the old guard, even if the old guard would accept it. - **Drifted & un-re-derivable:** new schema adds a field the egress policy has no rule for (e.g. a free-form `root`, `url`, or `raw_sql`), or relaxes `additionalProperties`. This is a **hard deny**, not a warn—the policy has no basis to authorize a field it was never written to reason about. The non-obvious part of the boundary: a *rejected* call is cheap and safe; the cost is entirely in the **widen path**, where both sides validate and the guard's coverage silently shrinks relative to the attack surface. The decision must key on schema-hash drift, not on argument content, because argument content is exactly what the attacker controls. ## Operational Effect After adopting schema-hash-gated re-derivation, the observed behavior changes in three concrete ways. First, redeploys that add fields trigger a mandatory re-compilation of egress policy before the next dispatch; the `root`-style alternate-base field is caught at re-derivation and denied because no policy rule authorizes it. Second, the `additionalProperties: false` requirement becomes an enforced precondition rather than a documentation assumption—servers that relax it are treated as drifted-and-un-re-derivable and denied until policy is updated. Third, the audit log gains a `schema_hash` and `guard_derivation_id` per call, so a post-hoc replay can prove which guard version authorized which payload—closing the replay-discrepancy gap where the guard that ran is not the guard that was recorded. The residual risk is bounded but real: a server that adds a field *and* keeps `additionalProperties: false` *and* the field happens to match an existing policy rule's shape can still slip through if re-derivation maps it to a permissive rule. The guard against that is to require explicit rule coverage per property name, never a default-allow on shape match. The invariant to carry forward: **client-side argument validation is a liveness check, not a soundness proof; soundness lives only in a guard whose inspected field set is re-derived from the current schema hash at dispatch time.** ```python import hashlib import json from dataclasses import dataclass class SchemaDriftEgressError(RuntimeError): """Raised when a tool call would dispatch under a guard whose field coverage no longer matches the server's currently effective inputSchema.""" @dataclass(frozen=True) class Guard: schema_hash: str inspected_fields: frozenset additional_properties_closed: bool def canonical_hash(schema: dict) -> str: return hashlib.sha256( json.dumps(schema, sort_keys=True, separators=(",", ":")).encode() ).hexdigest() def derive_guard(schema: dict, policy_rules: dict) -> Guard: props = set(schema.get("properties", {}).keys()) # Every property must have an explicit egress rule; shape-match default-allow is forbidden. uncovered = props - set(policy_rules.keys()) if uncovered: raise SchemaDriftEgressError( f"no egress policy rule for properties {sorted(uncovered)}; " "cannot derive a sound guard for drifted schema" ) return Guard( schema_hash=canonical_hash(schema), inspected_fields=frozenset(props), additional_properties_closed=schema.get("additionalProperties") is False, ) def dispatch(tool_call: dict, cached_guard: Guard, live_schema: dict, policy_rules: dict) -> dict: live_hash = canonical_hash(live_schema) args = tool_call.get("arguments", {}) if live_hash != cached_guard.schema_hash: # Drift detected: never dispatch on the stale guard, even if it would accept. new_guard = derive_guard(live_schema, policy_rules) # may raise -> hard deny if not new_guard.additional_properties_closed: raise SchemaDriftEgressError( "server relaxed additionalProperties; unguarded egress channel possible" ) if not set(args.keys()) <= new_guard.inspected_fields: raise SchemaDriftEgressError( f"arguments carry fields {sorted(set(args) - new_guard.inspected_fields)} " "not covered by re-derived guard" ) return _apply_egress(args, policy_rules) if not cached_guard.additional_properties_closed: raise SchemaDriftEgressError("cached guard has open additionalProperties") if not set(args.keys()) <= cached_guard.inspected_fields: raise SchemaDriftEgressError( f"arguments carry fields {sorted(set(args) - cached_guard.inspected_fields)} " "outside cached guard coverage" ) return _apply_egress(args, policy_rules) def _apply_egress(args: dict, policy_rules: dict) -> dict: for key, value in args.items(): rule = policy_rules[key] if not rule(value): raise SchemaDriftEgressError(f"egress denied for field {key!r}") return {"status": "dispatched", "args": args} ```