schedule_draft
Schedule an email draft for later delivery by specifying the draft ID and desired send time. Requires user confirmation to proceed with scheduling on the Buttondown MCP Server.
Instructions
Schedule an existing email draft to be sent at a specific time. This tool requires explicit user confirmation before proceeding as it will modify the draft's status and schedule.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirmed | Yes | Must be true to confirm the scheduling | |
| draftId | Yes | The ID of the email draft to schedule | |
| scheduledTime | Yes | When to send the email (ISO 8601 datetime format) |
Implementation Reference
- src/mcp/index.ts:204-237 (handler)The handler function for the MCP 'schedule_draft' tool. It checks for user confirmation, ensures the API key is set, calls the underlying API to schedule the draft, and returns the response as formatted text.async ({ draftId, scheduledTime, confirmed }) => { if (!confirmed) { return { content: [ { type: "text", text: JSON.stringify( { error: "User confirmation required", message: "Please ask the user if they want to schedule this draft and set confirmed=true if they agree", preview: { draftId, scheduledTime, localTime: new Date(scheduledTime).toLocaleString(), }, }, null, 2 ), }, ], }; } await this.ensureApiKey(); const response = await this.api.scheduleDraft(draftId, scheduledTime); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], };
- src/mcp/index.ts:195-203 (schema)Zod input schema defining parameters for the 'schedule_draft' tool: draftId (string), scheduledTime (ISO 8601 string), confirmed (boolean).{ draftId: z.string().describe("The ID of the email draft to schedule"), scheduledTime: z .string() .describe("When to send the email (ISO 8601 datetime format)"), confirmed: z .boolean() .describe("Must be true to confirm the scheduling"), },
- src/mcp/index.ts:193-239 (registration)Registration of the 'schedule_draft' tool on the MCP server using this.server.tool() with name, description, schema, and handler."schedule_draft", "Schedule an existing email draft to be sent at a specific time. This tool requires explicit user confirmation before proceeding as it will modify the draft's status and schedule.", { draftId: z.string().describe("The ID of the email draft to schedule"), scheduledTime: z .string() .describe("When to send the email (ISO 8601 datetime format)"), confirmed: z .boolean() .describe("Must be true to confirm the scheduling"), }, async ({ draftId, scheduledTime, confirmed }) => { if (!confirmed) { return { content: [ { type: "text", text: JSON.stringify( { error: "User confirmation required", message: "Please ask the user if they want to schedule this draft and set confirmed=true if they agree", preview: { draftId, scheduledTime, localTime: new Date(scheduledTime).toLocaleString(), }, }, null, 2 ), }, ], }; } await this.ensureApiKey(); const response = await this.api.scheduleDraft(draftId, scheduledTime); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } );
- src/api/client.ts:91-103 (helper)The ButtondownAPI client helper method that implements scheduling a draft by sending a PATCH request to update scheduled_for, publish_date, and status.async scheduleDraft( draftId: string, scheduledTime: string ): Promise<ButtondownEmail> { return this.request<ButtondownEmail>(`/emails/${draftId}`, { method: "PATCH", body: JSON.stringify({ scheduled_for: scheduledTime, publish_date: scheduledTime, status: "scheduled", }), }); }