Skip to content

Rulvar API reference


Rulvar API reference / @rulvar/rulvar / tool

Function: tool() ​

ts
function tool<S>(init): ToolDef<S>;

Defined in: packages/core/dist/index.d.ts

Defines a tool. Definition-time failures are typed ConfigErrors, never first-call surprises: an illegal name, a Standard Schema without the JSON Schema projection, a recursive local $ref, or a remote/dynamic reference all fail here.

Type Parameters ​

Type Parameter
S extends SchemaSpec&lt;unknown&gt;

Parameters ​

ParameterType
initToolInit&lt;S&gt;

Returns ​

ToolDef&lt;S&gt;