TanStack

BeforeToolCallDecision

Type Alias: BeforeToolCallDecision

ts
type BeforeToolCallDecision = 
  | void
  | undefined
  | null
  | {
  args: unknown;
  type: "transformArgs";
}
  | {
  result: unknown;
  type: "skip";
}
  | {
  reason?: string;
  type: "abort";
};

Defined in: packages/ai/src/activities/chat/middleware/types.ts:260

Decision returned from onBeforeToolCall.

  • undefined/void: continue with normal execution
  • { type: 'transformArgs', args }: replace args used for execution
  • { type: 'skip', result }: skip execution, use provided result
  • { type: 'abort', reason }: abort the entire chat run