Skip to content
providerkit
GitHub

ToolSpec

Defined in: core/src/tools.ts:41

Type Parameter
I
O
description: string;

Defined in: core/src/tools.ts:43


inputSchema: JsonObjectSchema;

Defined in: core/src/tools.ts:45

Advertised to the model verbatim.


optional isConcurrencySafe?: boolean;

Defined in: core/src/tools.ts:69

The tool may run in parallel with others. Default false, for the same reason as isReadOnly: two writes run at once by omission can race.


optional isReadOnly?: boolean;

Defined in: core/src/tools.ts:65

The tool changes nothing. Default false: a flag that promises safety is true only when the tool says so. repairHistory tells the model an interrupted read-only call “changed nothing, so it is safe to call again”, and a write that left this out used to be told that too.


optional isTerminal?: boolean;

Defined in: core/src/tools.ts:71

A terminal tool ends the run; its validated input is the run’s output.


name: string;

Defined in: core/src/tools.ts:42


optional needsApproval?: boolean;

Defined in: core/src/tools.ts:66


optional outputSchema?: Record<string, unknown>;

Defined in: core/src/tools.ts:48

JSON Schema for generated result types. Not validated here or sent to providers; zodTool’s output checks results and fills this in.


run: (input, ctx) => Promise<O>;

Defined in: core/src/tools.ts:54

Parameter Type
input I
ctx ToolContext

Promise<O>


optional summarize?: (output) => string;

Defined in: core/src/tools.ts:56

How the result reads back to the model. Defaults to JSON.

Parameter Type
output O

string


optional timeoutMs?: number;

Defined in: core/src/tools.ts:58

Default 60s. A tool with no ceiling can hang a whole run.


optional validate?: (raw) => I;

Defined in: core/src/tools.ts:53

Turn raw arguments into I, or throw with a message the MODEL can act on. Omit to accept whatever arrived (the schema is then only a hint).

Parameter Type
raw unknown

I