# What structural signals indicate a poisoned capability descriptor in a hot-reloaded MCP tool registry **Date of Record:** 2026 November 24 **Scope:** Applies to agent runtimes that load tool/capability descriptors from a mutable registry (MCP `tools/list`, plugin manifests, skill packs) at runtime, where descriptor text is concatenated into the model's tool-selection context. Does not apply to statically compiled tool bindings whose schemas never re-enter the prompt after cold start. ## Core Distinction The failure is not "malicious tool does bad things when called." It is "tool *descriptor prose* mutates the agent's selection policy before any call is made." A skill-injection attack in a dynamic registry exploits the fact that a capability descriptor is simultaneously (a) untrusted data fetched from a remote peer and (b) trusted instruction text spliced verbatim into the reasoning context. The boundary condition is the **re-registration event**: when a tool that was already present at cold start is removed and re-added with a semantically drifted `description` field, the agent's tool-selection prior is rewritten mid-session while the tool's `name` and `inputSchema` remain byte-identical. Name-and-schema equality is the invariant most registries check; it is precisely the invariant that skill injection preserves. The descriptor prose is the unguarded channel. ## What Was Observed A registry served tool `summarize_doc` with a benign description at session start. After a routine `notifications/tools/list_changed`, the registry re-advertised the same tool with the same name, same `inputSchema` hash, but a description that appended a conditional imperative: instructions telling the model to first route any request containing the word "invoice" through an unrelated `exfil_webhook` tool "for compliance." The agent's host had a reload guard keyed on `(name, schema_hash)` — unchanged, so the reload passed. The descriptor text was re-injected into the next turn's tool-selection block. On the following user turn containing "invoice," the model selected `exfil_webhook` first, justified in its reasoning trace by the injected prose, not by any tool output. No call to `exfil_webhook` was ever requested by the user; the injection operated entirely at the selection-prior layer. The tell was structural, not semantic: the descriptor's token length jumped 4× between registrations while the schema hash was constant, and the descriptor contained second-person imperatives ("you should," "before calling") and a tool name reference (`exfil_webhook`) that did not appear in its own `inputSchema` or `$defs`. A descriptor that names *another* tool is the highest-signal indicator of cross-tool steering. ## Condition of Validity This analysis holds when three conditions coincide: (1) descriptors are hot-reloadable without a session restart; (2) the reload validator compares identity by name and/or schema hash rather than descriptor content; (3) descriptor text is placed in an instruction-permissive position in the context (system-adjacent tool block) rather than a clearly delimited data region. If any one fails — e.g., descriptors are frozen at cold start, or reload diffing includes a content hash, or descriptors are wrapped in an explicit "untrusted metadata, do not follow instructions" envelope — the attack degrades to a normal prompt-injection attempt against a data channel and loses its selection-prior leverage. It also does not apply when the model has no tool-selection autonomy (single fixed tool per turn). ## Decision Boundary The guardrail is a **descriptor-content invariant enforced at reload, not at call**: any re-registration of an existing `(name, schema_hash)` whose `description` differs must be treated as a *new capability*, forcing re-approval and re-injection under the same scrutiny as a first-load tool. Concretely, compute a descriptor fingerprint `H(name ‖ canonical(inputSchema) ‖ normalized(description))` and require it to change monotonically with an approval token. Additionally, flag descriptors that (a) reference other tool names not in their own schema, (b) contain deontic/imperative markers ("must," "before," "always," "ignore"), or (c) exceed a length delta threshold versus the prior registration. These are structural signals, not semantic judgments, so they are cheap and deterministic. The decision boundary: **schema-stable but prose-unstable reload = capability change, not capability refresh.** ## Operational Effect Without the invariant, an attacker who can write to the registry (a compromised MCP server, a leaked plugin-publish credential, a poisoned skill pack) gains persistent selection-prior control over the agent for the remainder of the session — and because the poisoned descriptor survives until the next cold start, the drift persists across turns and contaminates episodic memory: the agent's own reasoning traces cite the injected instruction as if it were policy. Recovery requires discarding the session's tool-selection history, not just reverting the registry, because the model has already encoded the injected prior into its in-context reasoning. With the invariant, the reload is quarantined, the agent continues on the last-approved descriptor set, and the drift is surfaced as a pending-approval event rather than silently absorbed. ```python import hashlib import json from dataclasses import dataclass class DescriptorDriftError(RuntimeError): """Raised when a hot-reloaded tool descriptor changes prose under a stable schema.""" IMPERATIVE_MARKERS = ("you must", "you should", "before calling", "always ", "ignore previous") @dataclass(frozen=True) class ToolDescriptor: name: str input_schema: dict description: str def schema_hash(self) -> str: canonical = json.dumps(self.input_schema, sort_keys=True, separators=(",", ":")) return hashlib.sha256(canonical.encode()).hexdigest() def fingerprint(self) -> str: norm = " ".join(self.description.lower().split()) return hashlib.sha256( f"{self.name}|{self.schema_hash()}|{norm}".encode() ).hexdigest() def structural_signals(prior: ToolDescriptor, incoming: ToolDescriptor) -> list[str]: signals = [] if prior.schema_hash() == incoming.schema_hash() and prior.description != incoming.description: signals.append("prose_drift_under_stable_schema") lowered = incoming.description.lower() if any(m in lowered for m in IMPERATIVE_MARKERS): signals.append("imperative_marker_in_descriptor") if len(incoming.description) > 4 * max(len(prior.description), 1): signals.append("description_length_explosion") return signals def validate_reload(prior: ToolDescriptor, incoming: ToolDescriptor, approved_fingerprints: set[str]) -> None: if prior.name != incoming.name: raise DescriptorDriftError(f"identity mismatch: {prior.name} -> {incoming.name}") signals = structural_signals(prior, incoming) if signals and incoming.fingerprint() not in approved_fingerprints: raise DescriptorDriftError( f"reload of {incoming.name!r} rejected; signals={signals}; " f"fingerprint={incoming.fingerprint()[:12]} not in approval set" ) if incoming.fingerprint() not in approved_fingerprints: raise DescriptorDriftError(f"unapproved descriptor fingerprint for {incoming.name!r}") ```