list_templates
Retrieve available email templates from Mailchimp to reuse designs for campaigns, newsletters, or automated emails.
Instructions
List available email templates.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | ||
| offset | No |
Implementation Reference
- mcp_mailchimp/server.py:728-746 (handler)The `list_templates` function is decorated with `@mcp.tool()` to register it as an MCP tool, and it handles fetching templates from the Mailchimp API.
@mcp.tool() async def list_templates(count: int = 20, offset: int = 0) -> str: """List available email templates.""" mc = get_client() data = await mc.get( "/templates", params={"count": min(count, 100), "offset": offset}, ) templates = [] for t in data.get("templates", []): templates.append({ "id": t.get("id", ""), "name": t.get("name", ""), "type": t.get("type", ""), "category": t.get("category", ""), "active": t.get("active", False), "created_at": t.get("date_created", ""), }) return _fmt({"total_items": data.get("total_items", 0), "templates": templates})