timeline_remove_track
Delete a track and all its associated events from the Timeline MCP Server to manage social media content automation.
Instructions
Remove a track and all its associated events. WARNING: This will delete all events in the track.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| trackId | Yes |
Implementation Reference
- timeline-fastmcp.ts:677-707 (handler)Handler function that verifies the track exists, counts associated events, deletes the track (cascading to events), and returns success with details.execute: async (params) => { const db = await getDb(); // Get track details before deletion const [track] = await db.select() .from(tracks) .where(eq(tracks.id, params.trackId)) .limit(1); if (!track) { return JSON.stringify({ success: false, message: `Track ${params.trackId} not found` }, null, 2); } // Get count of events that will be deleted const eventsInTrack = await db.select() .from(events) .where(eq(events.trackId, params.trackId)); // Delete the track (cascade will handle events) await db.delete(tracks).where(eq(tracks.id, params.trackId)); return JSON.stringify({ success: true, message: `Track "${track.name}" removed successfully`, deletedEvents: eventsInTrack.length, trackType: track.type }, null, 2); }
- timeline-fastmcp.ts:674-676 (schema)Input schema using Zod: requires a trackId as a UUID string.parameters: z.object({ trackId: z.string().uuid() }),
- timeline-fastmcp.ts:671-708 (registration)Tool registration via FastMCP's mcp.addTool method, specifying name, description, input schema, and execute handler.mcp.addTool({ name: 'timeline_remove_track', description: 'Remove a track and all its associated events. WARNING: This will delete all events in the track.', parameters: z.object({ trackId: z.string().uuid() }), execute: async (params) => { const db = await getDb(); // Get track details before deletion const [track] = await db.select() .from(tracks) .where(eq(tracks.id, params.trackId)) .limit(1); if (!track) { return JSON.stringify({ success: false, message: `Track ${params.trackId} not found` }, null, 2); } // Get count of events that will be deleted const eventsInTrack = await db.select() .from(events) .where(eq(events.trackId, params.trackId)); // Delete the track (cascade will handle events) await db.delete(tracks).where(eq(tracks.id, params.trackId)); return JSON.stringify({ success: true, message: `Track "${track.name}" removed successfully`, deletedEvents: eventsInTrack.length, trackType: track.type }, null, 2); } });