lesson 4 of 7 · validate tool inputs — when the model invents argumentsvalidate tool inputs — when the model invents argumentslesson 4 of 7 · validate tool inputs — when the model invents argumentsvalidate tool inputs — when the model invents argumentslesson 4 of 7 · validate tool inputs — when the model invents argumentsvalidate tool inputs — when the model invents argumentslesson 4 of 7 · validate tool inputs — when the model invents argumentsvalidate tool inputs — when the model invents argumentslesson 4 of 7 · validate tool inputs — when the model invents argumentsvalidate tool inputs — when the model invents argumentslesson 4 of 7 · validate tool inputs — when the model invents argumentsvalidate tool inputs — when the model invents argumentslesson 4 of 7 · validate tool inputs — when the model invents argumentsvalidate tool inputs — when the model invents argumentslesson 4 of 7 · validate tool inputs — when the model invents argumentsvalidate tool inputs — when the model invents argumentslesson 4 of 7 · validate tool inputs — when the model invents argumentsvalidate tool inputs — when the model invents argumentslesson 4 of 7 · validate tool inputs — when the model invents argumentsvalidate tool inputs — when the model invents argumentslesson 4 of 7 · validate tool inputs — when the model invents argumentsvalidate tool inputs — when the model invents arguments
The dispatcher runs the tool BEFORE validating the args. The model
passed {"q": 42} instead of {"q": "ramen"} (number instead of
string). The tool's f-string still works, but downstream the
search API rejects it with a confusing 400 error.
Fix the dispatcher to validate FIRST, then only run the tool on valid args. On failure return the error message; never let the tool see bad input.
Expected output:
ERROR: q should be str, got int
The break is on line 14 — but read the whole snippet first.