Interface: ActionDef<TContext, TSharedArgs, TParams>
Defined in: packages/core/src/core/builder/defineTool.ts:54
Action definition within a defineTool() config.
When params is provided as a ParamsMap, the handler's args are automatically typed as InferParams<TParams> & TSharedArgs. When params is a ZodObject, use z.infer<typeof schema> for manual typing.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
TContext | - | Application context type |
TSharedArgs | Record<string, never> | Shared args inherited from ToolConfig.shared |
TParams extends ParamsMap | ParamsMap | Action-specific params (inferred from the params field) |
Properties
description?
optional description: string;Defined in: packages/core/src/core/builder/defineTool.ts:56
Human-readable description for the LLM
destructive?
optional destructive: boolean;Defined in: packages/core/src/core/builder/defineTool.ts:62
Mark as destructive (irreversible)
handler()
handler: (ctx, args) => Promise<ToolResponse>;Defined in: packages/core/src/core/builder/defineTool.ts:70
The handler function — args are fully typed when params is specified
Parameters
| Parameter | Type |
|---|---|
ctx | TContext |
args | TParams extends ParamsMap ? keyof TParams extends never ? TSharedArgs & Record<string, unknown> : { [K in string | number | symbol]: InferSingleParam<TParams[K]> } & { [K in string | number | symbol]?: InferSingleParam<TParams[K]> } & TSharedArgs : TSharedArgs & Record<string, unknown> |
Returns
Promise<ToolResponse>
idempotent?
optional idempotent: boolean;Defined in: packages/core/src/core/builder/defineTool.ts:64
Mark as idempotent (safe to retry)
omitCommon?
optional omitCommon: string[];Defined in: packages/core/src/core/builder/defineTool.ts:66
Common schema fields to omit for this action
params?
optional params:
| ZodObject<ZodRawShape, UnknownKeysParam, ZodTypeAny, {
[key: string]: any;
}, {
[key: string]: any;
}>
| TParams;Defined in: packages/core/src/core/builder/defineTool.ts:58
Parameter definitions (JSON descriptors or Zod schema)
readOnly?
optional readOnly: boolean;Defined in: packages/core/src/core/builder/defineTool.ts:60
Mark as read-only (no side effects)
returns?
optional returns: Presenter<unknown>;Defined in: packages/core/src/core/builder/defineTool.ts:68
MVA Presenter — when set, handler returns raw data instead of ToolResponse