Skip to main content
Glama

get_analytics

Retrieve analytics data for a specific email draft from Buttondown to track performance metrics and engagement insights.

Instructions

Retrieve analytics data for a specific email draft from Buttondown

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
draftIdYesThe ID of the email draft to get analytics for

Implementation Reference

  • The handler function for the 'get_analytics' MCP tool. It ensures the API key is set, retrieves analytics data for the given draft ID using the ButtondownAPI client, and returns the JSON-stringified response wrapped in MCP content format.
    async ({ draftId }) => { await this.ensureApiKey(); const response = await this.api.getAnalytics(draftId); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; }
  • Zod schema defining the input parameters for the 'get_analytics' tool: a required string draftId.
    { draftId: z .string() .describe("The ID of the email draft to get analytics for"), },
  • Registration of the 'get_analytics' tool on the MCP server, including name, description, input schema, and handler.
    this.server.tool( "get_analytics", "Retrieve analytics data for a specific email draft from Buttondown", { draftId: z .string() .describe("The ID of the email draft to get analytics for"), }, async ({ draftId }) => { await this.ensureApiKey(); const response = await this.api.getAnalytics(draftId); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } );
  • API client helper method that fetches analytics data via HTTP GET to Buttondown's /emails/{emailId}/analytics endpoint.
    async getAnalytics(emailId: string): Promise<ButtondownAnalytics> { return this.request<ButtondownAnalytics>(`/emails/${emailId}/analytics`); }

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