Intelligence · function
validateArgs
Check a model's arguments against a tool's schema.
Explained in Agents and behaviour.
function validateArgs(schema: ToolSchema, args: unknown): ValidationResultimport { validateArgs } from '@driftengine/ai';Parameters
| Parameter | Type | Description |
|---|---|---|
schema | ToolSchema | |
args | unknown |
In depth
Never throws. A model producing bad arguments is ordinary rather than
exceptional — it is the thing schemas exist for — and putting the ordinary case on
the exception path means every call site needs a try it will eventually forget.
An unknown field is a failure, not something to drop. A model inventing a field is a signal: it means the prompt and the schema disagree about the tool's shape, and silently discarding it is how that disagreement survives a release. What it costs: a provider that helpfully adds metadata to a tool call breaks until the schema names it. What would make it wrong: if a mainstream provider does that unavoidably, the answer is a declared passthrough field rather than a blanket tolerance.