run_cron_job
Execute a specific cron job in your PocketBase database by providing its unique job identifier.
Instructions
Triggers a single cron job by its id.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| jobId | Yes | The identifier of the cron job to run. |
Implementation Reference
- src/tools/cron-tools.ts:79-90 (handler)The actual implementation of the 'run_cron_job' tool. It takes a jobId argument, validates it, calls pb.crons.run(jobId) to trigger the cron job, and returns the result.
async function runCronJob(args: RunCronJobArgs, pb: PocketBase): Promise<ToolResult> { if (!args.jobId) { throw invalidParamsError("Missing required argument: jobId"); } // Make the API request to get a single log const result = await pb.crons.run(args.jobId) return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } - src/types/tool-types.ts:99-101 (schema)TypeScript interface defining the input arguments for the run_cron_job tool. It requires a 'jobId' string field.
export interface RunCronJobArgs { jobId: string; } - src/tools/cron-tools.ts:22-33 (registration)Registration of the 'run_cron_job' tool in cronToolInfo array, defining its name, description, and inputSchema (requiring 'jobId').
{ name: 'run_cron_job', description: 'Triggers a single cron job by its id.', inputSchema: { type: 'object', properties: { jobId: { type: 'string', description: 'The identifier of the cron job to run.' } }, required: ['jobId'] } } ]; - src/tools/index.ts:55-56 (registration)Routing logic that dispatches calls to 'run_cron_job' to handleCronToolCall.
} else if (name === 'list_cron_jobs' || name === 'run_cron_job') { return handleCronToolCall(name, toolArgs, pb); - src/tools/cron-tools.ts:44-51 (handler)Dispatch inside handleCronToolCall that routes 'run_cron_job' to the runCronJob function.
case 'run_cron_job': return runCronJob(args as RunCronJobArgs, pb); default: // This case should ideally not be reached due to routing in index.ts throw new Error(`Unknown cron tool: ${name}`); } }