list_segments
Retrieve all audience segments from a Mailchimp email list to analyze subscriber groups and target specific audiences for email campaigns.
Instructions
List all segments in a specific list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes | The list ID |
Implementation Reference
- src/services/mailchimp.ts:214-222 (handler)The core handler function that executes the logic to list segments for a given Mailchimp list ID by making a paginated API request.async listSegments( listId: string ): Promise<{ segments: MailchimpSegment[] }> { return await this.makePaginatedRequest( `/lists/${listId}/segments`, "created_at", "DESC" ); }
- src/tools/index.ts:231-244 (schema)Input schema definition for the list_segments tool, requiring a list_id parameter.{ name: "list_segments", description: "List all segments in a specific list", inputSchema: { type: "object", properties: { list_id: { type: "string", description: "The list ID", }, }, required: ["list_id"], }, },
- src/tools/index.ts:231-244 (registration)Registration of the list_segments tool in the getToolDefinitions array.{ name: "list_segments", description: "List all segments in a specific list", inputSchema: { type: "object", properties: { list_id: { type: "string", description: "The list ID", }, }, required: ["list_id"], }, },
- src/tools/index.ts:792-811 (handler)Tool dispatch handler in handleToolCall that invokes the service method and formats the response as JSON text.case "list_segments": const segments = await service.listSegments(args.list_id); return { content: [ { type: "text", text: JSON.stringify( segments.segments.map((s) => ({ id: s.id, name: s.name, member_count: s.member_count, type: s.type, created_at: s.created_at, })), null, 2 ), }, ], };