tool
tool<
F,A>(definition):ToolDefinition<F,A>
Declares a tool with its inputs and outputs typed end to end: values in run is
inferred from fields (values.name is a string for a text field) and action
from actions. Identity at runtime.
lookup: tool({ title: "npm", icon: "shippingbox", fields: [{ id: "name", type: "text", placeholder: "Package name" }], actions: [{ id: "lookup", title: "Look Up", role: "primary" }], async run(action, values, ctx) { return [status(values.name), table({ License: "MIT" })]; },})Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
F extends readonly ToolField[] |
[] |
A extends readonly ToolAction[] |
[] |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
definition |
ToolDefinition<F, A> |
Returns
Section titled “Returns”ToolDefinition<F, A>