list_files
Retrieve all files stored in Mailchimp's File Manager to access uploaded images, documents, and media for email campaigns.
Instructions
List all files in the File Manager
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/index.ts:975-993 (handler)The handler function for the 'list_files' tool. It invokes the service.listFiles() method and formats the list of files into a JSON string response for the MCP tool call.
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 (schema)The tool schema definition, specifying the name, description, and input schema (no required parameters). This is part of the tool registrations returned by getToolDefinitions.
{ name: "list_files", description: "List all files in the File Manager", inputSchema: { type: "object", properties: {}, required: [], }, }, - src/services/mailchimp.ts:270-276 (helper)Helper method in MailchimpService that performs a paginated GET request to the Mailchimp File Manager API endpoint to retrieve the list of files.
async listFiles(): Promise<{ files: MailchimpFile[] }> { return await this.makePaginatedRequest( "/file-manager/files", "created_at", "DESC" ); } - src/types/index.ts:705-721 (schema)TypeScript interface defining the structure of file objects returned by the Mailchimp File Manager API, used for type safety in the service layer.
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/index.ts:42-46 (registration)MCP server registration for listing tools. Returns all tool definitions (including list_files) via getToolDefinitions when ListTools is called.
server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: getToolDefinitions(mailchimpService), }; });