Code recipe · Advanced · 15 min
Tool call with schema validation and retry
Wrap a model tool call so bad arguments are caught and retried once with the error shown to the model.
- Claude
- ChatGPT
- Any assistant
- agents
- code
- typescript
Inside this code recipe
- Models sometimes emit arguments that do not match a tool's schema; executing them blindly causes errors deep in your code, while failing hard wastes the run.
- Language
- TypeScript
The full code recipe opens with a membership that covers AI Agents.
Sign in if you already subscribe.
Sign in
