list_webhooks
Retrieve all webhooks configured for a specific Mailchimp audience to monitor and integrate event-driven marketing actions.
Instructions
List webhooks configured for an audience.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- mcp_mailchimp/server.py:1135-1148 (handler)Handler function for the list_webhooks tool. It calls GET /lists/{list_id}/webhooks via the MailchimpClient, iterates over returned webhooks, extracts id/url/events/sources, and returns formatted JSON.
@mcp.tool() async def list_webhooks(list_id: str) -> str: """List webhooks configured for an audience.""" mc = get_client() data = await mc.get(f"/lists/{list_id}/webhooks") hooks = [] for w in data.get("webhooks", []): hooks.append({ "id": w.get("id", ""), "url": w.get("url", ""), "events": w.get("events", {}), "sources": w.get("sources", {}), }) return _fmt({"total_items": len(hooks), "webhooks": hooks}) - mcp_mailchimp/server.py:1130-1135 (registration)Tool registration via the @mcp.tool() decorator on the async function list_webhooks. It is registered in the FastMCP instance 'mcp' defined in the same file.
# ══════════════════════════════════════════════════════════════════════ # WEBHOOKS # ══════════════════════════════════════════════════════════════════════ @mcp.tool() - mcp_mailchimp/server.py:1136-1136 (schema)The input schema is implicit — list_webhooks takes a single string parameter 'list_id' (required, no default). The return type is str (formatted JSON).
async def list_webhooks(list_id: str) -> str: - mcp_mailchimp/server.py:41-43 (helper)Helper function _fmt is used by list_webhooks to pretty-print the response as JSON.
def _fmt(data: Any) -> str: """Format response data as indented JSON string.""" return json.dumps(data, indent=2, default=str)