Open Agent Loops
API Reference

validateToolArguments

@open-agent-loops/core


function validateToolArguments(tool, call): ToolArguments;

Defined in: tools/tools.ts:137

Validate a tool call against the tool's schema, returning the parsed arguments.

Parameters

ParameterTypeDescription
toolToolThe tool whose schema the call is checked against.
callToolCallThe model-emitted tool call, whose function.arguments is a JSON string.

Returns

ToolArguments

The parsed, schema-valid arguments as an object.

Remarks

The throwing counterpart of tryValidateToolArguments: it delegates the parse-and-check there and throws the reported error on failure. The loop converts that thrown error into an error tool-result rather than crashing the run.

Throws

Error if the arguments are not valid JSON.

Throws

Error if the parsed arguments fail the tool's Zod schema (the message lists the failing paths).

See

tryValidateToolArguments for the non-throwing variant.

On this page