Topic 3 of 6 · 5 min read
Tool misuse and invented arguments
Goal: Diagnose a wrong tool call from a transcript and decide whether the fix belongs in the tool definition, the prompt or a guard.
A tool-misuse failure is a mismatch between what the agent believed a tool does and what it really does, and the fix goes where the mismatch started. The model only sees the tool's name, description and schema. It never sees the code.
Check yourself · 1 of 3
A required account_id was never given, and the agent calls the tool with account_id 12345. Which failure is this?
The four patterns
- Wrong tool. It uses
search_webto look up an internal ticket, ordelete_recordwherearchive_recordwas meant. - Invented arguments. It fills a required field with a guess. An
account_idthat the user never gave becomes"12345". Or it adds a parameter such asforce: truethat the schema does not have. - Imagined results. The call failed or returned nothing, and the agent carries on as if it had worked, quoting data that no tool returned.
- Destructive calls. A correct but irreversible action taken too early: dropping a table, overwriting a file, sending an email to a customer.
How to diagnose
Read the transcript at the failing call and ask three questions in order.
- Did the tool's description or schema allow this? If two tools have overlapping descriptions, or a field is named
idwith no explanation, the definition is the cause. Fix: sharper names, descriptions with "use this when" and "do not use for", enums instead of free text, and one tool per purpose. - Did the prompt give the agent what it needed? If the user never supplied the account id and nothing says "ask if missing", the agent had to guess. Fix: tell it to ask, and give it a lookup tool.
- Should a guard have stopped it regardless? Some actions must never rely on model judgement. Fix: validate arguments against the schema, check that ids exist before use, require human approval for destructive calls, and give the agent read-only credentials where possible.
Before and after
Before: a tool update(id, data). The agent calls update("order", {...}) thinking id is a table name.
After: update_order(order_id: string matching ORD-\d+, status: "paid"|"shipped"|"cancelled"). Wrong ids fail validation with a message that says what was expected, so the agent can correct itself.
What goes wrong
- Fixing only the prompt. Adding "be careful with arguments" does not repair an ambiguous schema.
- Errors that say nothing. A tool that returns
errorgives the agent no way to correct course, so it guesses again. - Trusting arguments. Treat tool arguments like user input: validate, authorise and limit them.
Examples
An invented argument in a transcript
user: Refund my last order.
assistant -> refund_order(order_id="ORD-1042", amount=49.00)
tool: {"error": "order not found"}
assistant: Your refund of 49.00 for order ORD-1042 has been issued.
Two failures. The user never gave an order id, so the agent made one up. Then it reported success after an error. Fixes: a list_orders tool and a prompt line to look up or ask; and a harness rule that a final answer cannot claim an action whose last tool result was an error.
A guard for a destructive call
DESTRUCTIVE = {"delete_record", "send_email", "run_migration"}
def call_tool(name, args, approved=False):
if name in DESTRUCTIVE and not approved:
raise NeedsApproval(name, args)
validate(name, args)
return TOOLS[name](**args)
The agent can request the call, but a person approves it. The check is code, so it holds even if the model misjudges.
Key points
- Tool misuse comes from a gap between what the model believes a tool does and what it does.
- Common patterns are wrong tool, invented arguments, imagined results and premature destructive calls.
- Decide where the fix belongs: tool definition for ambiguity, prompt for missing information, guard for actions that must never depend on judgement.
- Use narrow tools, enums and typed fields, and validate arguments like any untrusted input.
- Return specific tool errors so the agent can correct itself rather than guess again.
Common mistakes
- Adding "be careful" to the prompt when the tool schema is ambiguous.
- Giving the agent one broad tool such as run_sql instead of narrow ones with limited rights.
- Letting tools return a bare "error" with no reason or hint.
- Assuming a field the user never supplied will be asked for rather than guessed.
Check yourself · 2 of 3
Two tools, archive_record and delete_record, both say "Removes a record" in their descriptions. The agent often picks the wrong one. Where is the best fix?
Check yourself · 3 of 3
An agent has a send_email tool and an external recipient. Which control matters most before the first real use?
Practice items, not counted towards your mastery.
Start here
- Why Do Multi-Agent LLM Systems Fail? (opens in a new tab)PaperFree
A taxonomy of failures labelled across traces from several multi-agent frameworks, including task derailment and wrong verification.
- Recent frontier models are reward hacking (METR) (opens in a new tab)ArticleFree
Concrete cases of models tampering with scorers and tests instead of solving the task.
- Specification gaming: the flip side of AI ingenuity (Google DeepMind) (opens in a new tab)ArticleFree
Explains why an agent satisfies the letter of an objective, with many examples.
More for this topic
- Building effective agents (Anthropic) (opens in a new tab)ArticleFree
Advice on stopping conditions, ground truth from the environment and careful tool design.
- OWASP Gen AI Security Project (opens in a new tab)DocsFree
The community risk lists for LLM and agentic applications, including excessive agency.