get_segment
Retrieve detailed information about a specific Mailchimp email list segment using list and segment IDs for targeted audience analysis.
Instructions
Get details of a specific segment
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes | The list ID | |
| segment_id | Yes | The segment ID |
Implementation Reference
- src/services/mailchimp.ts:224-229 (handler)The handler function that executes the core logic of fetching a Mailchimp segment by list ID and segment ID.async getSegment( listId: string, segmentId: number ): Promise<MailchimpSegment> { return await this.makeRequest(`/lists/${listId}/segments/${segmentId}`); }
- src/tools/index.ts:246-262 (schema)Input schema and tool definition for the get_segment tool.name: "get_segment", description: "Get details of a specific segment", inputSchema: { type: "object", properties: { list_id: { type: "string", description: "The list ID", }, segment_id: { type: "number", description: "The segment ID", }, }, required: ["list_id", "segment_id"], }, },
- src/tools/index.ts:813-822 (registration)Tool dispatch/registration in the handleToolCall switch statement, which calls the handler and returns the formatted response.case "get_segment": const segment = await service.getSegment(args.list_id, args.segment_id); return { content: [ { type: "text", text: JSON.stringify(segment, null, 2), }, ], };
- src/types/index.ts:482-506 (schema)TypeScript interface defining the structure of a Mailchimp segment (output type).export interface MailchimpSegment { id: number; name: string; member_count: number; type: "saved" | "static" | "fuzzy"; created_at: string; updated_at: string; options?: { match: "any" | "all"; conditions: Array<{ condition_type: string; op: string; field: string; value: string; }>; }; list_id: string; _links?: Array<{ rel: string; href: string; method: string; targetSchema?: string; schema?: string; }>; }