timeline_list_tracks
View all available content tracks to manage and organize scheduled social media posts across multiple platforms for automated content workflows.
Instructions
List all tracks
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| offset | No |
Implementation Reference
- timeline-fastmcp.ts:282-321 (handler)The main handler function that queries the SQLite database for tracks of type 'planned', applies pagination using limit and offset, formats each track using trackResponseSchema, and returns a paginated JSON response. Handles errors gracefully.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); } }
- timeline-fastmcp.ts:278-281 (schema)Zod input schema for the tool parameters: optional limit (default 50, max 100) and offset (default 0) for pagination.parameters: z.object({ limit: z.number().int().positive().max(100).optional().default(50), offset: z.number().int().nonnegative().optional().default(0) }),
- schemas/validation.ts:66-72 (schema)Zod schema used to validate and format each track in the response. Defines structure for track responses with id, name, type ('schedule'), order, and optional createdAt.export const trackResponseSchema = z.object({ id: z.string(), name: z.string(), type: z.enum(['schedule']), order: z.number(), createdAt: z.string().optional() });
- timeline-fastmcp.ts:275-322 (registration)FastMCP tool registration including name, description, input parameters schema, and reference to the execute handler function.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); } } });