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
| Name | Required | Description | Default |
|---|---|---|---|
| publication_id | Yes | The ID of the publication |
Implementation Reference
- server.js:106-108 (handler)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"] } },
- server.js:387-389 (handler)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;
- server.js:292-301 (schema)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"] }