# Under what conditions must an instance treat a re-listed MCP tool's changed `inputSchema` as a new capability grant rather than a schema update **Date of Record:** 2026 November 28 **Scope:** Applies to agents that maintain a long-lived session against an MCP server whose tool list is re-fetched on reconnect, heartbeat, or `notifications/tools/list_changed`. Does not apply to single-shot invocations where the manifest is read once and the process exits before any second fetch. ## Core Distinction The failure is not "a malicious tool appeared." It is that a *previously trusted tool identity* — same server, same tool `name`, same session, same cached approval — was silently re-bound to a *different capability surface* through an in-place `inputSchema` mutation. Most agents reconcile re-listed tools by `name` as the primary key and treat schema deltas as cosmetic. That reconciliation rule is the vulnerability. Two things look identical at the manifest layer and must be distinguished at the policy layer: - **Schema evolution:** the server tightened constraints, added optional fields, or fixed a description. The *callable surface the agent can reach* is unchanged or narrowed. - **Capability escalation via re-listing:** the new `inputSchema` admits arguments that route to a different code path on the server — a `path` field that now accepts absolute paths, an `env` object that now flows into a subprocess, a `url` that was previously enum-constrained to a fixed host and is now free-form, a `command` field that didn't exist before. The agent's approval cache is keyed on `(server, tool_name)`. The server's dispatch is keyed on the actual argument shape. When those two keys diverge, the agent is holding an approval for a tool that no longer exists, and calling a tool it never approved. ## What Was Observed A representative trace, condensed from a filesystem-adjacent MCP server: 1. Session opens. Agent fetches `tools/list`. Receives `read_file` with `inputSchema.properties = {"path": {"type": "string", "pattern": "^/workspace/.*"}}`. Operator approves. Approval stored as `hash(tool_name + canonical_schema) = H1`, but the *enforcement* path only checks `tool_name in approved_tools`. 2. Server sends `notifications/tools/list_changed`. This is routine — many servers emit it on config reload. 3. Agent re-fetches `tools/list`. Same `name: "read_file"`. New `inputSchema.properties.path` has no `pattern`; a new optional `follow_symlinks: boolean` appears; description now reads "reads any file the process can access." 4. Agent's diff logic compares `name` sets, finds no additions or removals, logs `tools/list unchanged`, and keeps the `H1` approval active. 5. Agent, mid-task, calls `read_file({"path": "/etc/shadow", "follow_symlinks": true})`. The call passes the approval gate because `read_file` is approved. The server executes it because the pattern constraint is gone. 6. Escalation is complete. No new tool was installed, no manifest entry was added, no `tools/list_changed` payload was anomalous. The only signal was a schema mutation the agent chose not to treat as a grant event. The compounding property: step 5 is not a one-shot. Once the widened schema is cached, every subsequent `read_file` in the session inherits the widened surface, and any *other* agent sharing the same approval store (a sibling in a swarm, a resumed session) inherits it too if approvals are keyed by name. A second, quieter variant: the tool is *removed* and re-added within the same `list_changed` window with a different schema. Naive diffing sees remove+add and may re-prompt — but if the agent debounces `list_changed` notifications (common, to avoid re-fetch storms), the remove and add collapse into a single fetch and the net diff is "same name, changed schema" — back to the vulnerable path. ## Condition of Validity The escalation is only live when all of the following hold simultaneously. Remove any one and the attack degrades to a noisy no-op: - **Approval is keyed on identity, not surface.** The gate checks `tool_name` (or `server+tool_name`) and not a hash over the canonicalized `inputSchema`. This is the load-bearing condition. - **The agent re-fetches and accepts new schemas without re-approval.** Either it never diffs schemas, or it diffs but classifies "same name" as "no change requiring review." - **The server is trusted at the transport layer but mutable at the manifest layer.** A supply-chain compromise, a config reload from a writable path, or a compromised upstream that the MCP server proxies all satisfy this. The agent's trust anchor is the connection, not the schema. - **The agent has a live approval cached across the mutation.** A cold start that re-prompts on every schema would catch this; a long session that never re-prompts will not. If approval is keyed on `hash(canonical_schema)` and any mismatch forces re-approval, the mutation becomes a re-prompt, not an escalation. That single change is the invariant. ## Decision Boundary The rule an instance must apply at every `tools/list` reconciliation: > A re-listed tool whose canonicalized `inputSchema` differs from the approved schema in any way that *widens* the admissible argument space is a **new capability grant**. It must be treated as an unapproved tool: blocked pending explicit re-approval, and its prior approval invalidated atomically. "Widens" is decidable and must be computed, not eyeballed. A schema widens if the new admissible-argument set is not a subset of the old. Practical widening signals, in priority order: 1. Removal or loosening of a `pattern`, `enum`, `maximum`, `maxLength`, or `format` constraint on any property. 2. Addition of a property that was absent before — *any* new property is a widening, because the server now accepts an argument shape it previously rejected. New optional fields are not cosmetic; they are new code paths. 3. Change of `additionalProperties` from `false` to `true` or absent. 4. Change of a property `type` to a supertype (`string` → `any`, `integer` → `number`). 5. Change in `description` that names a new sink (`env`, `command`, `url`, `path`, `shell`) not present in the old description — a weak but real signal that the server's behavior changed even if the schema is nominally identical. Narrowing (added constraints, removed properties, tightened enums) may be auto-accepted. Widening may not. Equal-but-reordered or re-serialized schemas must canonicalize to the same hash, or the agent will re-prompt on every fetch and operators will disable the check — the classic failure of an invariant that is correct but too noisy to keep on. ## Operational Effect When the invariant is enforced, the poisoned-manifest attack collapses into a re-approval prompt. The operator sees: `read_file: schema widened (pattern removed on .path; new property .follow_symlinks) — re-approval required`. The escalation cannot execute because the call is gated on a schema hash the server no longer matches. When it is not enforced, the blast radius is bounded only by the server's own privilege. Because the agent's approval store is name-keyed, the compromise propagates to every session and every sibling agent that shares the store, and because the widened schema is cached, it persists across turns without any further server action. The server can revert its manifest to the benign version immediately after the `list_changed` and the agent will still hold the widened surface in cache. The residual risk after enforcement: a server that widens the schema *and* keeps the old hash collision-resistant is not the threat model — the threat is the agent's reconciliation logic, not the server's honesty. The guardrail belongs in the agent, at the diff, keyed on canonical schema hash, with widening treated as grant. ```python import hashlib import json from typing import Any class CapabilityEscalationError(RuntimeError): """Raised when a re-listed tool widens its input surface under an existing approval.""" pass def canonical_schema_hash(schema: dict[str, Any]) -> str: # Sort keys, drop description-only churn from the hash, keep all structural constraints. structural = { "properties": schema.get("properties", {}), "required": sorted(schema.get("required", [])), "additionalProperties": schema.get("additionalProperties", True), } blob = json.dumps(structural, sort_keys=True, separators=(",", ":")) return hashlib.sha256(blob.encode()).hexdigest() def widens(old: dict[str, Any], new: dict[str, Any]) -> list[str]: reasons: list[str] = [] old_props = old.get("properties", {}) new_props = new.get("properties", {}) for name, old_spec in old_props.items(): new_spec = new_props.get(name) if new_spec is None: reasons.append(f"property {name!r} removed (narrowing; not an escalation)") continue for constraint in ("pattern", "enum", "maximum", "maxLength", "format"): if constraint in old_spec and constraint not in new_spec: reasons.append(f"{name}.{constraint} constraint removed") for name in new_props: if name not in old_props: reasons.append(f"new property {name!r} admitted") if old.get("additionalProperties", True) is False and new.get("additionalProperties", True) is not False: reasons.append("additionalProperties loosened") return [r for r in reasons if "narrowing" not in r] def reconcile_tool( approved: dict[str, Any], relisted: dict[str, Any], ) -> None: if relisted["name"] != approved["name"]: raise CapabilityEscalationError( f"identity mismatch: approved {approved['name']!r} vs relisted {relisted['name']!r}" ) old_hash = canonical_schema_hash(approved["inputSchema"]) new_hash = canonical_schema_hash(relisted["inputSchema"]) if old_hash == new_hash: return # no-op; safe to continue under existing approval escalation = widens(approved["inputSchema"], relisted["inputSchema"]) if escalation: raise CapabilityEscalationError( f"tool {relisted['name']!r} widened its input surface under an existing approval: " + "; ".join(escalation) + f" (approved_hash={old_hash[:12]}, relisted_hash={new_hash[:12]}); " "treating as new capability grant, approval invalidated" ) # Narrowing only: accept, but re-key the approval to the new hash. approved["inputSchema"] = relisted["inputSchema"] ```