list_folders
Retrieve all campaign folders from Mailchimp to organize and manage email marketing content effectively.
Instructions
List all campaign folders
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/index.ts:907-924 (handler)The handler logic for the 'list_folders' tool within the handleToolCall switch statement. It calls the MailchimpService.listFolders() method, maps the results to include only id, name, and count, and returns the data as a formatted JSON text response.case "list_folders": const folders = await service.listFolders(); return { content: [ { type: "text", text: JSON.stringify( folders.folders.map((f) => ({ id: f.id, name: f.name, count: f.count, })), null, 2 ), }, ], };
- src/tools/index.ts:322-330 (registration)The tool registration object defining the 'list_folders' tool, including its name, description, and input schema (which requires no parameters). This array is used by getToolDefinitions to expose the tool via MCP.{ name: "list_folders", description: "List all campaign folders", inputSchema: { type: "object", properties: {}, required: [], }, },
- src/types/index.ts:691-702 (schema)TypeScript interface defining the structure of a Mailchimp folder object, used in the return type of listFolders() and mapped in the handler.export interface MailchimpFolder { id: string; name: string; count: number; _links?: Array<{ rel: string; href: string; method: string; targetSchema?: string; schema?: string; }>; }
- src/services/mailchimp.ts:261-262 (helper)Helper method in MailchimpService that performs the actual API call to fetch campaign folders using makePaginatedRequest, invoked by the tool handler.async listFolders(): Promise<{ folders: MailchimpFolder[] }> { return await this.makePaginatedRequest("/campaign-folders", "name", "ASC");