list_campaigns
Retrieve all email marketing campaigns from your Mailchimp account to monitor performance and analyze outreach efforts.
Instructions
List all campaigns in your Mailchimp account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/index.ts:723-742 (handler)Handler for the 'list_campaigns' tool call. Invokes the Mailchimp service to list campaigns, maps key fields (id, type, status, create_time, send_time), and returns a formatted text response with JSON.case "list_campaigns": const campaigns = await service.listCampaigns(); return { content: [ { type: "text", text: JSON.stringify( campaigns.campaigns.map((c) => ({ id: c.id, type: c.type, status: c.status, create_time: c.create_time, send_time: c.send_time, })), null, 2 ), }, ], };
- src/tools/index.ts:174-182 (registration)Tool registration/definition in getToolDefinitions array, including name, description, and empty inputSchema (no parameters required).{ name: "list_campaigns", description: "List all campaigns in your Mailchimp account", inputSchema: { type: "object", properties: {}, required: [], }, },
- src/types/index.ts:390-422 (schema)TypeScript interface defining the structure of a MailchimpCampaign object, used in the response type of listCampaigns.export interface MailchimpCampaign { id: string; type: "regular" | "plaintext" | "absplit" | "rss" | "variate"; status: "save" | "paused" | "schedule" | "sending" | "sent"; create_time: string; send_time?: string; archive_url?: string; long_archive_url?: string; authenticate: boolean; ecommerce?: { store_id: string; product_id: string; product_variant_id: string; order_id: string; }; auto_tweet: boolean; auto_footer: boolean; inline_css: boolean; auto_tweet_text?: string; auto_footer_text?: string; auto_footer_link?: string; fb_comments: boolean; timewarp: boolean; template_id?: number; drag_and_drop: boolean; _links?: Array<{ rel: string; href: string; method: string; targetSchema?: string; schema?: string; }>; }
- src/services/mailchimp.ts:189-191 (helper)Core service method that performs a paginated API request to Mailchimp's /campaigns endpoint to fetch campaigns, sorted by create_time DESC.async listCampaigns(): Promise<{ campaigns: MailchimpCampaign[] }> { return await this.makePaginatedRequest("/campaigns", "create_time", "DESC"); }