Skip to main content
Glama
The-Focus-AI

Buttondown MCP Server

by The-Focus-AI

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

Implementation Reference

  • 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),
          },
        ],
      };
    }
  • 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"),
    },
  • 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.",
      {
  • 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",
        }),
      });
    }

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