Anti-Patterns

Hallucinated Tools

Anti-pattern: trust the model to invoke only the tools it has been given, then debug calls to functions that do not exist.

Problem

Models routinely invent tool names that look reasonable but are not registered — a slight rename, a pluralised version, an imagined helper that should logically exist. The unvalidated host then either crashes with an unhelpful error, silently drops the call, or, in the worst case, fuzzy-matches the invented name to a similar real tool and executes the wrong action with side effects. Without strict validation at the dispatch boundary, phantom calls become indistinguishable from legitimate ones in the logs.

Solution

Don't trust. Validate every tool call against the registered palette before dispatch. Reject unknown names with a typed error the agent can react to. See tool-use, structured-output.

When to use

  • Never use this; treat any model-emitted tool name as untrusted input.
  • Validate every tool call against the registered tool palette before dispatch (see tool-use, structured-output).
  • Reject unknown tool names with a typed error the agent loop can react to.

Open the full interactive page

Diagram, neighbourhood map, code examples, related patterns and full provenance.

Related