Skip to main content
Glama

list_campaigns

Retrieve email campaigns from Mailchimp with filtering options by status or audience list to manage marketing communications.

Instructions

List email campaigns. Filter by status (save, paused, schedule, sending, sent) or audience list_id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusNo
list_idNo
countNo
offsetNo

Implementation Reference

  • Implementation of the 'list_campaigns' MCP tool. It fetches campaign data from the Mailchimp API, filters based on optional parameters, formats the result, and returns it as an MCP tool response.
    @mcp.tool()
    async def list_campaigns(
        status: str = "",
        list_id: str = "",
        count: int = 20,
        offset: int = 0,
    ) -> str:
        """List email campaigns. Filter by status (save, paused, schedule, sending, sent) or audience list_id."""
        mc = get_client()
        params: dict[str, Any] = {"count": min(count, 100), "offset": offset}
        if status:
            params["status"] = status
        if list_id:
            params["list_id"] = list_id
        data = await mc.get("/campaigns", params=params)
        campaigns = []
        for c in data.get("campaigns", []):
            s = c.get("settings", {})
            campaigns.append({
                "id": c["id"],
                "title": s.get("title", ""),
                "subject_line": s.get("subject_line", ""),
                "status": c.get("status", ""),
                "type": c.get("type", ""),
                "send_time": c.get("send_time"),
                "emails_sent": c.get("emails_sent", 0),
            })
        return _fmt({"total_items": data.get("total_items", 0), "campaigns": campaigns})

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AlexlaGuardia/mcp-mailchimp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server