timeline_update_scheduled_event
Modify scheduled social media posts by updating content, timing, approval status, or platform settings for events across multiple networks.
Instructions
Update an existing scheduled event
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eventId | Yes | ||
| updates | Yes |
Implementation Reference
- timeline-fastmcp.ts:589-648 (handler)The handler function executes the tool logic: fetches DB, applies updates to the event (name, prompt, time, etc.), validates scheduled time is future, prepares for SQLite, updates and selects the event, returns JSON success with event details or error.execute: async (params) => { const db = await getDb(); try { const updates: any = { updatedAt: new Date() }; if (params.updates.name) updates.name = params.updates.name; if (params.updates.prompt) { updates.prompt = params.updates.prompt; // Store prompt string directly updates.contentGenerated = false; // Reset generation status if prompt changes } if (params.updates.scheduledTime) { const newScheduledTime = new Date(params.updates.scheduledTime); if (newScheduledTime <= new Date()) { throw new Error('Scheduled time must be in the future'); } updates.scheduledTime = newScheduledTime; updates.generationTime = calculateGenerationTime(newScheduledTime); } if (params.updates.approved !== undefined) updates.approved = params.updates.approved; if (params.updates.platform) updates.platform = params.updates.platform; if (params.updates.metadata) updates.metadata = JSON.stringify(params.updates.metadata); // Convert dates and booleans for SQLite const dbUpdates = prepareEventForDb(updates); await db.update(events) .set(dbUpdates) .where(eq(events.id, params.eventId)); const [updated] = await db.select().from(events).where(eq(events.id, params.eventId)); if (!updated) { return JSON.stringify({ success: false, error: 'Event not found' }, null, 2); } return JSON.stringify({ success: true, event: { id: updated.id, name: updated.name, scheduledTime: updated.scheduledTime, approved: updated.approved, platform: updated.platform } }, null, 2); } catch (error) { if (error instanceof z.ZodError) { return JSON.stringify({ success: false, error: 'Validation error', details: error.errors }, null, 2); } throw error; } }
- timeline-fastmcp.ts:576-588 (schema)Zod schema defining required eventId (UUID) and updates object with optional fields for name, prompt, scheduledTime, approved, platform, metadata; ensures at least one update field.parameters: z.object({ eventId: z.string().uuid(), updates: z.object({ name: z.string().min(1).max(200).optional(), prompt: z.string().min(1).max(5000).optional(), scheduledTime: isoDateTimeSchema.optional(), approved: z.boolean().optional(), platform: platformSchema.optional(), metadata: z.record(z.any()).optional().describe('Platform-specific metadata') }).refine(data => Object.keys(data).length > 0, { message: 'At least one update field must be provided' }) }),
- timeline-fastmcp.ts:573-649 (registration)Registers the tool with MCP using addTool, specifying name, description, input schema, and handler function.mcp.addTool({ name: 'timeline_update_scheduled_event', description: 'Update an existing scheduled event', parameters: z.object({ eventId: z.string().uuid(), updates: z.object({ name: z.string().min(1).max(200).optional(), prompt: z.string().min(1).max(5000).optional(), scheduledTime: isoDateTimeSchema.optional(), approved: z.boolean().optional(), platform: platformSchema.optional(), metadata: z.record(z.any()).optional().describe('Platform-specific metadata') }).refine(data => Object.keys(data).length > 0, { message: 'At least one update field must be provided' }) }), execute: async (params) => { const db = await getDb(); try { const updates: any = { updatedAt: new Date() }; if (params.updates.name) updates.name = params.updates.name; if (params.updates.prompt) { updates.prompt = params.updates.prompt; // Store prompt string directly updates.contentGenerated = false; // Reset generation status if prompt changes } if (params.updates.scheduledTime) { const newScheduledTime = new Date(params.updates.scheduledTime); if (newScheduledTime <= new Date()) { throw new Error('Scheduled time must be in the future'); } updates.scheduledTime = newScheduledTime; updates.generationTime = calculateGenerationTime(newScheduledTime); } if (params.updates.approved !== undefined) updates.approved = params.updates.approved; if (params.updates.platform) updates.platform = params.updates.platform; if (params.updates.metadata) updates.metadata = JSON.stringify(params.updates.metadata); // Convert dates and booleans for SQLite const dbUpdates = prepareEventForDb(updates); await db.update(events) .set(dbUpdates) .where(eq(events.id, params.eventId)); const [updated] = await db.select().from(events).where(eq(events.id, params.eventId)); if (!updated) { return JSON.stringify({ success: false, error: 'Event not found' }, null, 2); } return JSON.stringify({ success: true, event: { id: updated.id, name: updated.name, scheduledTime: updated.scheduledTime, approved: updated.approved, platform: updated.platform } }, null, 2); } catch (error) { if (error instanceof z.ZodError) { return JSON.stringify({ success: false, error: 'Validation error', details: error.errors }, null, 2); } throw error; } } });