Skip to main content
Glama

create_draft

Initiate email draft creation in Buttondown by specifying content and optional title. Requires user confirmation to proceed, ensuring controlled and deliberate email drafting.

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
NameRequiredDescriptionDefault
confirmedYesMust be true to confirm the draft creation
contentYesThe main content/body of the email draft
titleNoOptional title/subject for the email draft

Implementation Reference

  • Executes the create_draft tool logic: validates confirmation, ensures API key, creates draft via API client, returns JSON 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), }, ], }; }
  • Input schema definition using Zod for the create_draft tool parameters.
    { 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"), },
  • Registers the 'create_draft' tool on the MCP server, including description, schema, and handler function.
    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.", { 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"), }, 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), }, ], }; } );
  • API client method that performs the HTTP POST request to Buttondown's /emails endpoint to create a new draft.
    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", }), }); }
  • TypeScript interface definition for the createDraft method in the ButtondownAPI.
    createDraft(content: string, title?: string): Promise<ButtondownEmail>;

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/The-Focus-AI/buttondown-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server