auto_blacklist_zones
Automatically identify and block underperforming ad zones in a campaign to optimize advertising spend and improve campaign performance.
Instructions
Automatically find and blacklist underperforming zones for a campaign.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| campaign_id | Yes | Campaign ID | |
| min_spend | No | Minimum spend to consider (default: $10) | |
| max_conversions | No | Maximum conversions (default: 0) | |
| date_from | No | Start date | |
| date_to | No | End date | |
| dry_run | No | If true, show zones but don't blacklist (default: true) |
Implementation Reference
- src/propellerads_mcp/server.py:837-870 (handler)The implementation of the 'auto_blacklist_zones' tool handler, which identifies underperforming zones and optionally blacklists them.
elif name == "auto_blacklist_zones": zones = client.get_zone_statistics( campaign_id=args["campaign_id"], date_from=args.get("date_from"), date_to=args.get("date_to"), ) min_spend = args.get("min_spend", 10) max_conv = args.get("max_conversions", 0) dry_run = args.get("dry_run", True) underperforming = [] for z in zones: spend = z.get("spend", z.get("cost", 0)) or 0 conv = z.get("conversions", 0) or 0 if spend >= min_spend and conv <= max_conv: underperforming.append(z) if not underperforming: return "No underperforming zones found." zone_ids = [z.get("zone_id") for z in underperforming if z.get("zone_id")] total_spend = sum(z.get("spend", z.get("cost", 0)) or 0 for z in underperforming) if dry_run: return ( f"# Dry Run - Zones to Blacklist\n\n" f"Found {len(zone_ids)} underperforming zones.\n" f"Total wasted spend: {format_currency(total_spend)}\n\n" f"Zone IDs: `{zone_ids}`\n\n" f"Run with `dry_run: false` to actually blacklist these zones." ) else: result = client.add_zones_to_blacklist(args["campaign_id"], zone_ids) - The schema definition for the 'auto_blacklist_zones' tool, including input arguments like campaign_id, min_spend, and max_conversions.
Tool( name="auto_blacklist_zones", description="Automatically find and blacklist underperforming zones for a campaign.", inputSchema={ "type": "object", "properties": { "campaign_id": {"type": "integer", "description": "Campaign ID"}, "min_spend": { "type": "number", "description": "Minimum spend to consider (default: $10)", }, "max_conversions": { "type": "integer", "description": "Maximum conversions (default: 0)", }, "date_from": {"type": "string", "description": "Start date"}, "date_to": {"type": "string", "description": "End date"}, "dry_run": { "type": "boolean", "description": "If true, show zones but don't blacklist (default: true)", }, }, "required": ["campaign_id"], }, ),