Standard library only · runs in your browser
Models hallucinate arguments: wrong types, missing fields, extra fields they made up. Check them against the tool's JSON Schema before you run anything, and produce error messages clear enough for the model to fix its own call.
Implement validate_arguments(arguments, schema). It returns a list of error strings, and [] means valid.
schema looks like {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}. Supported types are string, number (int or float), integer, boolean, array and object.
Produce errors in this order:
required order that's missing: missing required argument 'city'arguments:properties: unexpected argument 'units'argument 'a' should be number, got stringName the received type in JSON terms: string, boolean, integer, number, array, object or null.
validate_arguments(arguments: dict, schema: dict) -> list[str]