Skip to content

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 ParameterDefault typeDescription
TContext-Application context type
TSharedArgsRecord<string, never>Shared args inherited from ToolConfig.shared
TParams extends ParamsMapParamsMapAction-specific params (inferred from the params field)

Properties

description?

ts
optional description: string;

Defined in: packages/core/src/core/builder/defineTool.ts:56

Human-readable description for the LLM


destructive?

ts
optional destructive: boolean;

Defined in: packages/core/src/core/builder/defineTool.ts:62

Mark as destructive (irreversible)


handler()

ts
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

ParameterType
ctxTContext
argsTParams 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?

ts
optional idempotent: boolean;

Defined in: packages/core/src/core/builder/defineTool.ts:64

Mark as idempotent (safe to retry)


omitCommon?

ts
optional omitCommon: string[];

Defined in: packages/core/src/core/builder/defineTool.ts:66

Common schema fields to omit for this action


params?

ts
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?

ts
optional readOnly: boolean;

Defined in: packages/core/src/core/builder/defineTool.ts:60

Mark as read-only (no side effects)


returns?

ts
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