Safety checklist
- Keep tool schemas minimal and explicit.
- Validate parsed arguments before execution.
- Allowlist tool names; reject unknown tools.
- Add timeouts and retries for external calls.
- Log call id, tool name, and validation failures.
Request validation example (TypeScript + Zod)
Failure strategy
If validation fails:- Do not execute the tool.
- Return a controlled error payload into the next model turn.
- Ask the model to retry with corrected arguments.