Skip to main content
Glama
ousepachn

Beehiiv Analytics MCP Server

by ousepachn

get_segments

Retrieve audience segments for a specific Beehiiv newsletter publication to analyze subscriber groups and target content effectively.

Instructions

Get segments for a publication

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
publication_idYesThe ID of the publication

Implementation Reference

  • Core implementation of the get_segments tool: fetches segments from Beehiiv API endpoint using HTTP GET request.
    async getSegments(publicationId) {
      return await makeRequest('GET', `${this.baseUrl}/publications/${publicationId}/segments`, this.headers);
    }
  • server.js:289-302 (registration)
    Registration of the get_segments tool in the tools/list response, including name, description, and input schema definition.
    {
      name: "get_segments",
      description: "Get segments for a publication",
      inputSchema: {
        type: "object",
        properties: {
          publication_id: {
            type: "string",
            description: "The ID of the publication"
          }
        },
        required: ["publication_id"]
      }
    },
  • Tool dispatch handler in the tools/call case switch that calls the getSegments implementation.
    case 'get_segments':
      result = await client.getSegments(args.publication_id);
      break;
  • Input schema definition for the get_segments tool, specifying the required publication_id parameter.
    inputSchema: {
      type: "object",
      properties: {
        publication_id: {
          type: "string",
          description: "The ID of the publication"
        }
      },
      required: ["publication_id"]
    }

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/ousepachn/beehiivanalyticsMCP'

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