create_batch_operation
Submit up to 500 Mailchimp API operations in a single batch request by specifying method, path, and body for each operation.
Instructions
Submit a batch of API operations. operations: JSON array of {method, path, body} objects. Max 500 ops.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operations | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- mcp_mailchimp/server.py:1296-1314 (handler)The actual handler function for the create_batch_operation tool. It accepts a JSON string of operations, parses it, sends up to 500 operations to the Mailchimp /batches endpoint, and returns the batch ID and status.
@mcp.tool() async def create_batch_operation(operations: str) -> str: """Submit a batch of API operations. operations: JSON array of {method, path, body} objects. Max 500 ops.""" mc = get_client() import json as _json try: ops = _json.loads(operations) except _json.JSONDecodeError: return "Invalid JSON. Provide an array of {method, path, body} objects." if not isinstance(ops, list): return "operations must be a JSON array." data = await mc.post("/batches", json={"operations": ops[:500]}) return _fmt({ "batch_id": data.get("id", ""), "status": data.get("status", ""), "total_operations": data.get("total_operations", 0), "submitted_at": data.get("submitted_at", ""), "message": "Batch submitted. Check status with the batch ID.", }) - mcp_mailchimp/server.py:1296-1297 (registration)The @mcp.tool() decorator registers this function as an MCP tool named 'create_batch_operation' with the FastMCP server instance.
@mcp.tool() async def create_batch_operation(operations: str) -> str: