list_interests
Retrieve individual interest options (checkboxes or radio items) from a specified Mailchimp interest category. Accepts list ID, category ID, and optional count parameter.
Instructions
List interests (individual options) within a category — the actual checkbox/radio items.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes | ||
| category_id | Yes | ||
| count | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- mcp_mailchimp/server.py:1044-1060 (handler)The `list_interests` handler function. Tool decorated with @mcp.tool(), accepts list_id, category_id, and count params. Calls Mailchimp API GET /lists/{list_id}/interest-categories/{category_id}/interests and returns formatted interest data.
@mcp.tool() async def list_interests(list_id: str, category_id: str, count: int = 50) -> str: """List interests (individual options) within a category — the actual checkbox/radio items.""" mc = get_client() data = await mc.get( f"/lists/{list_id}/interest-categories/{category_id}/interests", params={"count": min(count, 100)}, ) interests = [] for i in data.get("interests", []): interests.append({ "id": i.get("id", ""), "name": i.get("name", ""), "subscriber_count": i.get("subscriber_count", 0), "display_order": i.get("display_order", 0), }) return _fmt({"total_items": data.get("total_items", 0), "interests": interests}) - mcp_mailchimp/server.py:1044-1044 (registration)The tool registration via @mcp.tool() decorator on the `list_interests` async function. The FastMCP instance `mcp` handles tool registration from the decorator.
@mcp.tool() - mcp_mailchimp/server.py:1045-1045 (schema)Input schema for list_interests: requires list_id (str), category_id (str), and optional count (int, default 50). Returns formatted JSON string.
async def list_interests(list_id: str, category_id: str, count: int = 50) -> str: - mcp_mailchimp/server.py:41-43 (helper)The `_fmt` helper function used by list_interests to format output as indented JSON.
def _fmt(data: Any) -> str: """Format response data as indented JSON string.""" return json.dumps(data, indent=2, default=str)