list_members
Retrieve all subscribers from a specific Mailchimp email list using the list ID to manage audience data.
Instructions
List all members in a specific list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes | The list ID |
Implementation Reference
- src/tools/index.ts:756-775 (handler)The handler for the 'list_members' tool call. It invokes MailchimpService.listMembers with the provided list_id, maps the members data, and returns formatted text content for the MCP response.case "list_members": const members = await service.listMembers(args.list_id); return { content: [ { type: "text", text: JSON.stringify( members.members.map((m) => ({ id: m.id, email_address: m.email_address, status: m.status, member_rating: m.member_rating, last_changed: m.last_changed, })), null, 2 ), }, ], };
- src/tools/index.ts:198-210 (schema)Input schema definition for the 'list_members' tool, specifying the required 'list_id' parameter.{ name: "list_members", description: "List all members in a specific list", inputSchema: { type: "object", properties: { list_id: { type: "string", description: "The list ID", }, }, required: ["list_id"], },
- src/index.ts:42-46 (registration)Registers all tools, including 'list_members', by providing the tool definitions from getToolDefinitions in response to ListToolsRequest.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: getToolDefinitions(mailchimpService), }; });
- src/services/mailchimp.ts:198-204 (helper)Helper method in MailchimpService that makes a paginated API request to retrieve members from a specified Mailchimp list.async listMembers(listId: string): Promise<{ members: MailchimpMember[] }> { return await this.makePaginatedRequest( `/lists/${listId}/members`, "timestamp_signup", "DESC" ); }
- src/types/index.ts:425-479 (schema)TypeScript interface defining the structure of a MailchimpMember, used for typing the output of listMembers.export interface MailchimpMember { id: string; email_address: string; unique_email_id: string; email_type: string; status: | "subscribed" | "unsubscribed" | "cleaned" | "pending" | "transactional"; merge_fields: Record<string, any>; interests: Record<string, boolean>; stats: { avg_open_rate: number; avg_click_rate: number; ecommerce_data?: { total_revenue: number; number_of_orders: number; currency_code: string; }; }; ip_signup?: string; timestamp_signup?: string; ip_opt?: string; timestamp_opt?: string; member_rating: number; last_changed: string; language?: string; vip: boolean; email_client?: string; location?: { latitude: number; longitude: number; gmtoff: number; dstoff: number; country_code: string; timezone: string; region: string; }; source?: string; tags_count: number; tags: Array<{ id: number; name: string; }>; list_id: string; _links?: Array<{ rel: string; href: string; method: string; targetSchema?: string; schema?: string; }>; }