Skip to main content
Glama

list_segments

Retrieve saved audience segments from Mailchimp to organize and target specific subscriber groups for marketing campaigns.

Instructions

List saved segments for an audience.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
list_idYes
countNo
offsetNo

Implementation Reference

  • The list_segments tool handler, which fetches segments for a given Mailchimp audience list ID.
    @mcp.tool()
    async def list_segments(list_id: str, count: int = 20, offset: int = 0) -> str:
        """List saved segments for an audience."""
        mc = get_client()
        data = await mc.get(
            f"/lists/{list_id}/segments",
            params={"count": min(count, 100), "offset": offset},
        )
        segments = []
        for s in data.get("segments", []):
            segments.append({
                "id": s.get("id", ""),
                "name": s.get("name", ""),
                "member_count": s.get("member_count", 0),
                "type": s.get("type", ""),
                "created_at": s.get("created_at", ""),
                "updated_at": s.get("updated_at", ""),
            })
        return _fmt({"total_items": data.get("total_items", 0), "segments": segments})

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