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
Write dispatch_with_validation(tool_name, args) that:
- Looks up
SCHEMAS[tool_name]. If missing, return"UNKNOWN_TOOL: <name>"(don't crash). - Runs
validate(args, schema). If invalid, return"VALIDATION_ERROR: <error message>". - On valid: looks up
TOOLS[tool_name], calls it with**verdict["args"], returns the result.
Three cases run for you. Expected output:
results for ramen
VALIDATION_ERROR: missing required field: q
UNKNOWN_TOOL: frobnicate