Tools List Schema Validation
Validate every advertised schema as JSON Schema before a client tries to obey it
Use when: a tool's input schema was edited and clients construct arguments from it
Avoid when: the tool takes no arguments and its schema is a constant empty object
Procedure
- Read tools/list output and collect every inputSchema
- Check each schema is an object with type object and a properties map
- Check required names exist in properties
- Check enums are non-empty and defaults satisfy their own constraints
- Check additionalProperties is explicitly false where strictness is intended
- Add the checks to the test suite so a schema edit cannot regress
Signals
- no required key is missing from properties
- every enum has at least one value
- no default value violates its own bounds
- strict tools declare additionalProperties false
Patterns
1. Required check
set(schema['required']) <= set(schema['properties'])
2. Bounds check
1 <= default <= maximum
3. Strictness
additionalProperties is False, not absent
Pitfalls
- Assuming a client validates the schema and finding out it does not
- Leaving a default outside its own min or max
- Declaring required keys that the handler treats as optional
Done when
- every advertised schema passes the structural checks
- the checks run in CI on every change