Skip to main content

validate_against_schema

Function validate_against_schema 

Source
pub fn validate_against_schema(
    args: &ToolArgs,
    schema: &ToolSchema,
) -> Vec<ValidationIssue>
Expand description

Validate arguments against a tool schema.

Splits schema.params into positional and named/flag groups so the positional slot index never conflates with the struct-field index. With clap-derived schemas, positionals sit after the flags in struct order; the old single-index walk would have falsely failed mkdir foo because the path slot lives at struct index 1+.

Checks:

  • Required parameters are provided (positionals by slot, flags by name).
  • Unknown flags (warning).
  • Type compatibility for both positional and named args.