Overview

Allternit supports strict tool schemas — a mode where the LLM provider validates tool arguments against the declared JSON Schema before the tool is executed. Arguments outside the schema are rejected at the provider level, preventing malformed inputs from reaching your tool’s execute function.

Enabling strict mode

Strict mode is enabled per-tool at registration:
All native tools in the NativeToolBelt are registered with strict: true by default.

What strict mode enforces

Schema requirements

For strict mode to work with provider-level validation, your schema must:
  1. Declare type: "object" at the root.
  2. List all properties explicitly in properties.
  3. Include a required array listing all mandatory fields.
  4. Not use $ref, oneOf, anyOf, or allOf at the top level (provider limitation).

Error handling

When strict validation fails, the provider returns an error before your tool is called. The harness surfaces this as a tool error:

When to use strict mode

  • Use strict mode for tools with well-defined, stable schemas — especially tools exposed to external models or MCP clients.
  • Skip strict mode for tools that accept freeform input or that need to evolve their schema without versioning.