list_files
Retrieve all files from the Mailchimp File Manager to manage and access stored assets for email campaigns.
Instructions
List all files in the File Manager
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/index.ts:975-993 (handler)The handler logic for the "list_files" tool within the handleToolCall switch statement. It invokes service.listFiles(), maps the files to a simplified structure (id, name, size, created_at), and returns formatted JSON text content as per MCP tool response format.case "list_files": const files = await service.listFiles(); return { content: [ { type: "text", text: JSON.stringify( files.files.map((f) => ({ id: f.id, name: f.name, size: f.size, created_at: f.created_at, })), null, 2 ), }, ], };
- src/tools/index.ts:379-387 (registration)Registration of the "list_files" tool in the getToolDefinitions function. Defines the tool name, description, and empty input schema (no parameters required). This array is used to expose tools to the MCP server.{ name: "list_files", description: "List all files in the File Manager", inputSchema: { type: "object", properties: {}, required: [], }, },
- src/types/index.ts:705-721 (schema)TypeScript interface defining the structure of a MailchimpFile, used in the return type of listFiles() and mapped in the handler response.export interface MailchimpFile { id: string; folder_id: string; name: string; file_data: string; type: string; size: number; created_at: string; created_by: string; _links?: Array<{ rel: string; href: string; method: string; targetSchema?: string; schema?: string; }>; }
- src/services/mailchimp.ts:270-276 (helper)Core helper method in MailchimpService that performs a paginated GET request to the Mailchimp File Manager API endpoint '/file-manager/files', sorted by created_at descending.async listFiles(): Promise<{ files: MailchimpFile[] }> { return await this.makePaginatedRequest( "/file-manager/files", "created_at", "DESC" ); }