Appearance
Interface: ChatToolDef<TInput>
Defined in: packages/sdk/src/renderer/chat-driver.ts:69
A tool the model may call, with a skill-side execute. The tool's name is its key in the ChatTools map — so it is unique by construction and never repeated as a field on the definition.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
TInput | { prompt: string; } | The tool's input arguments, inferred from inputSchema (defaults to {prompt: string} when no schema is given). |
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
execute | (args: { input: TInput; text: string; }) => | ChatToolResult | Promise<ChatToolResult> | The tool's action. Runs immediately when there's no confirm, or only after approval when there is. Put the real effect here. Throwing is safe — it's caught and shown as a graceful error to the user and (on aiSdk) fed back to the model. | packages/sdk/src/renderer/chat-driver.ts:77 |
confirm? | (args: { input: TInput; text: string; }) => ChatConfirmResult | Promise<ChatConfirmResult> | Require approval before this tool acts. Returning a message (or a full spec) is the gate: the user sees the prompt, and execute runs only after they approve — on BOTH the chrome-ai and aiSdk paths, so a destructive tool can never fire un-approved. On reject, execute is skipped and rejectedReply (or "Cancelled.") is shown. May be async, and may return a falsy value to skip the gate for this call (conditional confirmation). | packages/sdk/src/renderer/chat-driver.ts:90 |
inputSchema? | ZodType<TInput, unknown, $ZodTypeInternals<TInput, unknown>> | Zod schema for the tool's input. Omit it and the input is {prompt: string} (the model's distilled request). With a schema, the model produces typed args — native function-calling on aiSdk, structured output on chrome-ai — and execute receives them parsed + validated. | packages/sdk/src/renderer/chat-driver.ts:100 |