Skip to main content
Glama

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
NameRequiredDescriptionDefault
limitNo
offsetNo

Implementation Reference

  • 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); } }
  • 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) }),
  • 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() });
  • 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); } } });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/derekalia/timeline-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server