Tool design · 2026-09-23

The model keeps passing status values your API rejects - "done", "complete", "finished".

  1. AConstrain the parameter to an enum in the tool schema
  2. BAdd «please use only valid status values» to the system prompt
  3. CNormalize whatever arrives with a mapping table on your side
  4. DRetry the tool call until a valid value comes back

Answer: A

Constrain the parameter to an enum in the tool schema

Why

What the schema forbids the model cannot emit; what the prompt asks for it can forget. A mapping table is a real fallback, but it hides the ambiguity instead of removing it.

More on this topic

More on Way of the Agent

Real situations from building agents - with the answer and why.

Solve a new one every day on the Path