create_segment
Create static segments in Mailchimp by providing a list of email addresses to organize subscribers for targeted email campaigns.
Instructions
Create a static segment from email addresses. emails: comma-separated list.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes | ||
| name | Yes | ||
| emails | No |
Implementation Reference
- mcp_mailchimp/server.py:703-720 (handler)Implementation of the create_segment tool handler, which creates a static segment in Mailchimp.
@mcp.tool() async def create_segment( list_id: str, name: str, emails: str = "", ) -> str: """Create a static segment from email addresses. emails: comma-separated list.""" mc = get_client() body: dict[str, Any] = {"name": name} if emails: body["static_segment"] = [e.strip() for e in emails.split(",") if e.strip()] s = await mc.post(f"/lists/{list_id}/segments", json=body) return _fmt({ "id": s.get("id", ""), "name": s.get("name", ""), "member_count": s.get("member_count", 0), "message": "Segment created.", })