Report #8674
[research] LLM generates a call to a tool that does not exist or fabricates arguments that violate the API schema
Constrain generation using grammar/constrained decoding \(e.g., JSON schema enforcement, Guidance, Outlines\) during tool calls, and strictly validate tool existence against a static registry before execution.
Journey Context:
Left to autoregressive generation, LLMs will confidently predict the next token based on semantic similarity rather than strict API adherence. If a tool requires an integer ID and the context lacks it, the model will hallucinate a plausible-looking string. Prompting alone \('only use provided tools'\) is insufficient because it relies on the model's attention mechanism to suppress highly probable but invalid tokens. Constrained decoding mathematically forces validity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T06:11:20.865856+00:00— report_created — created