list_templates
Retrieve available email templates from Mailchimp to use in campaigns. Filter results by template type and control the number displayed.
Instructions
List available Mailchimp email templates.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of results (default 10) | |
| type | No | Filter by type: user, base, gallery |
Implementation Reference
- server.js:43-64 (handler)Registration and implementation of the "list_templates" tool.
// --- Tool 2: List Templates --- server.tool( "list_templates", "List available Mailchimp email templates.", { count: z.number().optional().describe("Number of results (default 10)"), type: z.string().optional().describe("Filter by type: user, base, gallery"), }, async ({ count, type }) => { const opts = { count: count || 10 }; if (type) opts.type = type; const response = await mailchimp.templates.list(opts); const templates = response.templates.map((t) => ({ id: t.id, name: t.name, type: t.type, category: t.category, date_created: t.date_created, })); return { content: [{ type: "text", text: JSON.stringify(templates, null, 2) }] }; } );