Skip to content

ToolDefinition

A tool as you write it: its spec (minus id, which is its key in tools) plus the code behind it.

Type Parameter Default type
F extends readonly ToolField[] readonly ToolField[]
A extends readonly ToolAction[] readonly ToolAction[]

optional actions?: A


optional category?: ToolCategory


optional clipboardKinds?: readonly ClipboardKind[]


optional dropActions?: readonly ToolDropAction[]


optional fields?: F


icon: string

SF Symbol name.


optional live?: boolean


optional remembersInputs?: boolean


optional summary?: string

One line: what it does for you.


title: string

One or two short words: it sits under an icon in the tray.

optional drop(action, files, ctx): Promise<ToolDropResult>

Runs one of dropActions on dropped files (absolute paths). Required when dropActions is set.

Parameter Type
action string
files string[]
ctx ToolContext

Promise<ToolDropResult>


run(action, values, ctx): Promise<ToolBlock[]>

Runs one of actions. Return the output blocks; throw an Error whose message says what went wrong and what to do (“Can’t reach npm. Check your connection.”) and Blipbar shows it as a failed status.

Parameter Type
action A[number]["id"]
values ToolValues<F>
ctx ToolContext

Promise<ToolBlock[]>