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
- Cite this entry when dispatch code calls whatever function name the model emits.
- You are already here if logs show invocations of tools that were never registered.
- Validate every call against the registered palette and reject unknown names with a typed error (see tool-use, structured-output).
Open the full interactive page →
Diagram, neighbourhood map, code examples, related patterns and full provenance.