list_cron_jobs
List all app-level cron jobs registered in your PocketBase application, with optional field selection to customize returned data.
Instructions
Returns list with all registered app level cron jobs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fields | No | Comma separated string of the fields to return in the JSON response (by default returns all fields). Ex.:?fields=*,expand.relField.name |
Implementation Reference
- src/tools/cron-tools.ts:55-77 (handler)The actual handler function that executes the 'list_cron_jobs' tool logic. It calls pb.crons.getFullList() with optional fields parameter and returns the result as JSON.
async function listCronJobs(args: ListCronJobsArgs, pb: PocketBase): Promise<ToolResult> { const { fields } = args; try { const result = await pb.crons.getFullList({ fields }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } catch (error) { // If there's an error, return a more descriptive error if (error instanceof Error) { return { content: [{ type: 'text', text: `Error fetching cron list: ${error.message}` }], isError: true }; } throw error; } } - src/types/tool-types.ts:95-97 (schema)TypeScript interface for the input arguments of list_cron_jobs. Defines an optional 'fields' string property to filter returned fields.
export interface ListCronJobsArgs { fields?: string; } - src/tools/cron-tools.ts:11-37 (registration)Tool info registration for list_cron_jobs including its name, description, and inputSchema. Exposed via listCronTools() function.
const cronToolInfo: ToolInfo[] = [ { name: 'list_cron_jobs', description: 'Returns list with all registered app level cron jobs.', inputSchema: { type: 'object', properties: { fields: { type: 'string', description: 'Comma separated string of the fields to return in the JSON response (by default returns all fields). Ex.:?fields=*,expand.relField.name' } } } }, { 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'] } } ]; export function listCronTools(): ToolInfo[] { return cronToolInfo; } - src/tools/index.ts:55-56 (registration)Routing in the central tool handler that dispatches 'list_cron_jobs' calls to handleCronToolCall().
} else if (name === 'list_cron_jobs' || name === 'run_cron_job') { return handleCronToolCall(name, toolArgs, pb); - src/tools/cron-tools.ts:40-43 (helper)Dispatch function that routes the tool call name to the listCronJobs handler via a switch statement.
export async function handleCronToolCall(name: string, args: any, pb: PocketBase): Promise<ToolResult> { switch (name) { case 'list_cron_jobs': return listCronJobs(args as ListCronJobsArgs, pb);