update_campaign
Update a Mailchimp campaign's settings by providing only the fields you want to modify, including subject line, from name, reply to, title, and preview text.
Instructions
Update campaign settings. Only provide fields you want to change.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| campaign_id | Yes | ||
| subject_line | No | ||
| from_name | No | ||
| reply_to | No | ||
| title | No | ||
| preview_text | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- mcp_mailchimp/server.py:166-196 (handler)The update_campaign tool handler. Takes campaign_id plus optional fields (subject_line, from_name, reply_to, title, preview_text), builds a settings dict with only the provided non-empty fields, and sends a PATCH request to Mailchimp's /campaigns/{campaign_id} endpoint.
@mcp.tool() async def update_campaign( campaign_id: str, subject_line: str = "", from_name: str = "", reply_to: str = "", title: str = "", preview_text: str = "", ) -> str: """Update campaign settings. Only provide fields you want to change.""" mc = get_client() settings: dict[str, str] = {} if subject_line: settings["subject_line"] = subject_line if from_name: settings["from_name"] = from_name if reply_to: settings["reply_to"] = reply_to if title: settings["title"] = title if preview_text: settings["preview_text"] = preview_text if not settings: return "No fields provided to update." c = await mc.patch(f"/campaigns/{campaign_id}", json={"settings": settings}) return _fmt({ "id": c["id"], "status": c.get("status", ""), "updated_fields": list(settings.keys()), "message": "Campaign updated.", }) - mcp_mailchimp/server.py:166-167 (registration)The tool is registered via the @mcp.tool() decorator on the async function update_campaign, using the FastMCP framework's decorator pattern.
@mcp.tool() async def update_campaign( - mcp_mailchimp/client.py:64-64 (helper)The MailchimpClient.patch() helper method used by update_campaign to send the PATCH HTTP request to Mailchimp's API.
async def patch(self, path: str, json: dict[str, Any]) -> Any: