timeline_update_scheduled_event
Modify scheduled social media events by updating details like content, timing, approval status, or platform-specific settings for automated posting workflows.
Instructions
Update an existing scheduled event
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eventId | Yes | ||
| updates | Yes |
Implementation Reference
- timeline-fastmcp.ts:589-649 (handler)Handler function that updates the scheduled event in the database. Applies the provided updates to fields like name, prompt, scheduledTime, approved, platform, and metadata. Resets contentGenerated if prompt changes, recalculates generationTime if scheduledTime changes, and ensures scheduledTime is in the future.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 for input parameters: requires eventId (UUID) and an updates object with at least one optional field (name, prompt, scheduledTime, approved, platform, metadata).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-575 (registration)Registration of the timeline_update_scheduled_event tool with FastMCP using mcp.addTool, including name, description, parameters schema, and execute handler.mcp.addTool({ name: 'timeline_update_scheduled_event', description: 'Update an existing scheduled event',