Skip to main content
Run periodic tasks: clean expired data, sync records, generate reports. Your function fires automatically according to the schedule you configure. Pattern: config.cron + isCron guard + secrets for external connections.
index.ts

Configure secrets

Why it works this way

  • config.cron defines when it runs. You can have multiple schedules with different timezones.
  • The guard if (!ctx.isCron) prevents someone from running the cleanup via HTTP accidentally.
  • config.mcp: false — a maintenance task is not an AI tool.
  • ctx.trigger.cron tells you which schedule triggered the execution.