Docs
Cloudflare
Railway
CodeRabbit
AG Grid
WorkOS
Clerk
Netlify
OpenRouter
SerpAPI
Sentry
Electric
Unkey
Prisma
Cloudflare
Railway
CodeRabbit
AG Grid
WorkOS
Clerk
Netlify
OpenRouter
SerpAPI
Sentry
Electric
Unkey
Prisma
Class References
Function References
Interface References
Type Alias References
Variable References

BeforeToolCallDecision

Type Alias: BeforeToolCallDecision

ts
type BeforeToolCallDecision = 
  | void
  | undefined
  | null
  | {
  args: unknown;
  type: "transformArgs";
}
  | {
  result: unknown;
  type: "skip";
}
  | {
  reason?: string;
  type: "abort";
};
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:182

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