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:

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.

Original post →

More from coding & agent

coding & agent channel →