timeline_list_tracks
Retrieve all scheduled social media campaigns with pagination controls to manage content automation across multiple platforms.
Instructions
List all tracks
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| offset | No |
Implementation Reference
- timeline-fastmcp.ts:275-322 (handler)The complete implementation of the 'timeline_list_tracks' tool, including registration via mcp.addTool, input parameters schema with pagination options, and the execute handler that queries the database for planned tracks, applies ordering and pagination, parses responses using trackResponseSchema, and returns a JSON-formatted list.mcp.addTool({ name: 'timeline_list_tracks', description: 'List all tracks', parameters: z.object({ limit: z.number().int().positive().max(100).optional().default(50), offset: z.number().int().nonnegative().optional().default(0) }), execute: async (params) => { console.error('[Timeline MCP] List tracks called'); try { const db = await getDb(); const results = await db.select().from(tracks) .where(eq(tracks.type, 'planned')) .orderBy(asc(tracks.order)) .limit(params.limit) .offset(params.offset); console.error('[Timeline MCP] Found tracks:', results.length); const response = { tracks: results.map(track => trackResponseSchema.parse({ id: track.id, name: track.name, type: 'schedule', order: track.order, createdAt: track.createdAt })), pagination: { limit: params.limit, offset: params.offset, total: results.length } }; return JSON.stringify(response, null, 2); } catch (error) { console.error('[Timeline MCP] Error in list_tracks:', error); return JSON.stringify({ success: false, error: error instanceof Error ? error.message : 'Unknown error occurred', stack: error instanceof Error ? error.stack : undefined }, null, 2); } } });
- schemas/validation.ts:66-72 (schema)Output schema used in the tool response to validate and structure track data returned by timeline_list_tracks.export const trackResponseSchema = z.object({ id: z.string(), name: z.string(), type: z.enum(['schedule']), order: z.number(), createdAt: z.string().optional() });