CHAPTER 03 · Tool Design · 6 / 11
Schema discipline
The parameter schema is your guardrail against malformed calls. Tighten it:
- Use enums for fields with a fixed set of values. The model can't send an invalid option.
- Use bounds (
minimum/maximum) for numbers. "Create up to 20 copies," not unbounded. - Mark required fields explicitly, and keep optional fields genuinely optional.
- Describe each field, not just the tool. A field description like "~40 characters immediately preceding the target text, used to disambiguate" teaches the model how to fill it.
- Keep schemas flat where possible. Deeply nested schemas are harder for models to fill correctly.
A tight schema reduces the rate of malformed calls, which reduces error-recovery loops, which improves latency and reliability.