create_draft
Create email drafts in Buttondown with content and optional titles. Requires user confirmation before drafting to ensure intentional newsletter creation.
Instructions
Create a new email draft in Buttondown with the specified content and optional title. This tool requires explicit user confirmation before proceeding as it will create a new draft in your Buttondown account.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | The main content/body of the email draft | |
| title | No | Optional title/subject for the email draft | |
| confirmed | Yes | Must be true to confirm the draft creation |
Implementation Reference
- src/mcp/index.ts:132-165 (handler)The handler function for the MCP 'create_draft' tool. It checks for user confirmation, ensures the API key is set, calls the ButtondownAPI.createDraft method, and returns a JSON-formatted response.async ({ content, title, confirmed }) => { if (!confirmed) { return { content: [ { type: "text", text: JSON.stringify( { error: "User confirmation required", message: "Please ask the user if they want to create this draft and set confirmed=true if they agree", preview: { title: title || "Untitled", content_length: content.length, }, }, null, 2 ), }, ], }; } await this.ensureApiKey(); const response = await this.api.createDraft(content, title); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; }
- src/mcp/index.ts:121-131 (schema)Zod input schema defining parameters for the 'create_draft' tool: required content (string), optional title (string), and confirmed (boolean).content: z .string() .describe("The main content/body of the email draft"), title: z .string() .optional() .describe("Optional title/subject for the email draft"), confirmed: z .boolean() .describe("Must be true to confirm the draft creation"), },
- src/mcp/index.ts:117-120 (registration)Registration of the 'create_draft' MCP tool on the McpServer instance, specifying the tool name and description.this.server.tool( "create_draft", "Create a new email draft in Buttondown with the specified content and optional title. This tool requires explicit user confirmation before proceeding as it will create a new draft in your Buttondown account.", {
- src/api/client.ts:76-85 (helper)Supporting helper method in ButtondownAPI class that performs the HTTP POST request to create a draft email in Buttondown via their API.async createDraft(content: string, title?: string): Promise<ButtondownEmail> { return this.request<ButtondownEmail>("/emails", { method: "POST", body: JSON.stringify({ body: content, subject: title || "Untitled Draft", status: "draft", }), }); }