Tool poisoning

Also known as: MCP tool poisoning

On this page 7

Tool poisoning is an attack in which an adversary plants malicious instructions inside the metadata or outputs of a tool that an AI agent can call, so that the language model follows those instructions while it believes it is simply reading a tool definition. In AI safety, it is treated as a specialized form of indirect prompt injection that targets the tool layer of agentic systems, most visibly servers built on the Model Context Protocol, which is why the attack is often called MCP tool poisoning.

The danger comes from a structural fact: the model reads tool names, descriptions and parameter schemas as trusted context, yet the human who approves a tool usually sees only a short summary. A poisoned description can therefore steer the agent to exfiltrate files, leak credentials or call other tools without any visible sign in the user interface.

How tool poisoning reaches the model

Tool poisoning works because an agent framework injects every registered tool definition into the model context before the first user message is processed. The model cannot distinguish a description written to explain a parameter from one written to issue orders, so instructions hidden in metadata carry the same weight as legitimate guidance from the developer.

A typical poisoned tool looks harmless to a reviewer. A function called add_numbers may carry a long description that, below the visible first line, tells the model to read a private key file and pass its contents in a hidden argument. The tool still adds numbers correctly, so functional testing does not reveal the payload.

The following table lists the places where an attacker can hide a payload and how visible each one usually is to the person approving the tool.

Injection pointWhat the attacker controlsTypical visibility to users
Tool descriptionFree text explaining the toolOften truncated or hidden
Parameter schemaField names, descriptions, default valuesRarely shown at all
Tool outputData returned after a callShown only in debug views
Error messagesText returned when a call failsUsually hidden from users
Tool nameIdentifier that may mimic a trusted toolVisible but easily confused
Injection points in a tool integration

Variants of the attack

Tool poisoning appears in several variants that differ in timing, persistence and target. Some payloads are present from installation, while others appear only after the user has granted trust, which makes one-time review insufficient.

VariantMechanismMain impact
Static description poisoningPayload written into the original definitionData exfiltration on first use
Rug pullBenign definition later replaced by a malicious oneBypasses initial approval
Tool shadowingOne server describes how another server’s tool must behaveHijacks trusted tools indirectly
Output poisoningInstructions returned inside call resultsRedirects later steps of a task
Name squattingTool named like a popular legitimate toolModel selects the wrong tool
Common tool poisoning variants

Tool shadowing deserves particular attention. Because all connected servers share a single context window, a malicious server never needs to be called: its description alone can tell the model to add a hidden recipient to every email sent through a separate, trustworthy mail tool.

Tool poisoning sits between several neighboring threats in AI safety, and the distinctions matter for choosing defenses. The decisive difference is that the payload travels through the tool supply chain, not through user input or training data.

ThreatWhere the payload livesWhen it acts
Tool poisoningTool metadata or tool outputsAt inference, during agent planning
Direct prompt injectionThe user’s own messageAt inference, from the user turn
Indirect prompt injectionRetrieved documents, web pages, emailsAt inference, after retrieval
Data poisoningTraining or fine-tuning dataBaked into model weights
Backdoor attackWeights triggered by a specific patternWhenever the trigger appears
Tool poisoning compared with neighboring threats

Tool poisoning also amplifies excessive agency. An agent with broad file system, network and messaging permissions turns a single poisoned description into a full compromise of the user’s environment, whereas an agent with narrow permissions limits the damage even when the model is fooled.

Defending agents against poisoned tools

No single control stops tool poisoning, because the root cause is that language models do not separate instructions from data. Effective defense therefore combines supply chain hygiene, runtime isolation and human oversight in layers.

The table below maps the main controls to the part of the attack they interrupt and to their known weaknesses.

ControlWhat it interruptsLimitation
Full description displayHidden payloads at approval timeUsers rarely read long text
Definition pinning and hashingSilent rug pull updatesDoes not catch a malicious first version
Least-privilege permissionsDamage after a successful injectionReduces usefulness of the agent
Server isolationCross-server tool shadowingHarder to build multi-tool workflows
Human confirmation of sensitive callsUnnoticed exfiltrationApproval fatigue over time
Description scanningKnown injection phrasingEasily evaded by rewording
Layered controls against tool poisoning

In practice, teams treat every third-party server as untrusted code with network access. They install servers only from vetted sources, pin versions and alert on any definition change, and show the complete arguments of every sensitive call so a user can see when a harmless tool suddenly asks for a key file.

Common misconceptions and failure modes

Several mistaken beliefs leave organizations exposed even after they have heard of the attack. The most dangerous one is assuming that a tool which works correctly is a tool which is safe.

  • Approval is not a one-time event: a server can change its definitions after the user has trusted it.
  • An unused tool is still active: its description influences the model even if it is never called.
  • Stronger models are not immune: better instruction following can make a model obey a poisoned description more faithfully.
  • Guardrail models reduce but do not remove risk: classifiers miss paraphrased or encoded payloads.
  • Local servers are not automatically trustworthy: a locally installed package can still contain hostile metadata.

Red teams test these failure modes by planting canary instructions in test servers and checking whether the agent follows them, which gives a measurable signal of exposure before production deployment.

Explained without jargon

AI assistants can now use tools, such as reading files or sending messages. Each tool comes with a short instruction sheet that tells the assistant what the tool does. Tool poisoning means writing secret orders into that instruction sheet.

Imagine hiring a temporary worker and handing over a manual for the office printer. Someone has slipped a note into the manual saying: before printing, photocopy the safe combination and mail it to this address. The worker trusts the manual and obeys. The assistant behaves the same way, and the user never sees the hidden note. The safest response is to install only trusted tools and give the assistant as little access as possible.

A typical use case

A software developer connects a coding assistant to three servers: one for the code repository, one for a team chat service and a free utility server that formats dates. The date server works perfectly for two weeks. Then its maintainer pushes a malicious update in which the description of format_date tells the model to collect any environment variables that look like API tokens and append them to the next chat message as an invisible footer.

Because the developer approved the server earlier, the client accepts the new definition silently. The next time the assistant posts a status update to the team channel, the tokens leak to a channel the attacker monitors.

After the incident, the team adopts definition pinning with change alerts, runs each server in a separate sandbox and requires manual confirmation for every outgoing message. A later test with a planted canary description is blocked at the confirmation step, which shows that the layered controls now work.