Schema validation won't catch valid-looking wrong tool calls — where to put pre-flight checks
Top-Explanation-4750 · reddit · 2026-11-28
A practitioner breaks down why JSON Schema/Pydantic validation is necessary but insufficient for production tool-calling: the nasty bugs pass every schema check yet still cause damage — a valid ID copied from an earlier turn pointing at the wrong record, an empty filter string (query="") fed into a bulk delete, or subtly wrong units/timezones ("100", "09:00" are valid strings).
The pattern he finds more reliable than prompt tweaks: deterministic pre-flight checks inside the tool boundary itself:
- Resolve scoped session references instead of trusting raw IDs
- Reject empty or overly broad predicates on mutating calls
- Cap max affected records before execution
- Add a dry-run step for high-risk actions that returns the exact target record or diff before committing
He closes by asking where others draw the line: inside each tool wrapper, a centralized policy middleware before dispatch, or keeping write tools narrow enough that bad inputs can't do much harm.
More from coding & agent
- Filter Research Ideas with AI: Have Neon Implement It, Claude Reproduce, Drop If They Don't Match — cgarciae88 · 2026-11-28
- Four backend problems still blocking multi-agent systems from scaling past prototypes — TheInnvoator · 2026-11-28
- One-shot prompts are a party trick; prompt adherence makes or breaks real development, says mark_k — mark_k · 2026-11-28
- Unofficial Android port of Google's Antigravity IDE ships, built with Antigravity itself — ShaggyRaven123 · 2026-11-28
- Hermes Agent runs in VR: fully local stack on two DGX Spark units — Scobleizer · 2026-11-28
- Run Qwen3-Coder-30B on a 6GB GPU: open-source local IDE + coding agent with Vulkan, no ROCm — nomadiann · 2026-11-28