Expand description
Structural validation of tool-call arguments against declared schemas.
Every tool advertises a JSON Schema for its parameters (built-ins in
defs.rs, Rhai script tools via their compiled @param annotations, MCP
tools via the server’s inputSchema). Until issue #155 nothing checked a
model’s arguments against that schema: handlers did ad-hoc presence checks
that could not tell {"path": 42} from a missing path, and extra or
misspelled properties passed through silently. This module is the one
validator dispatch consults before a call is executed.
Two properties are load-bearing:
- A schema that does not compile skips validation instead of refusing
calls. Garbage schemas are reachable in normal operation - a typo’d
Rhai
@param n strng requiredcompiles to{"type": "strng"}, and MCP servers may send fragments this crate cannot interpret. Refusing those calls would break working tools;ArgValidation::SchemaUnusablelets the caller log and dispatch anyway. - External
$refs never resolve. Thejsonschemadependency is built withdefault-features = false, so a server-supplied schema referencing an external URI fails to compile (and is skipped, per the point above) rather than fetching over the network or filesystem at validation time.
Modules§
- format
- Built-in well-formedness checks for common output formats.
Enums§
- ArgValidation
- The outcome of checking one tool call’s arguments against its schema.
Functions§
- validate_
output - Validate a submitted final output against the schema its blueprint declared.
- validate_
tool_ args - Validate
argsagainstschema, the exact parameter schema advertised to the model fortool_name.