{
  "id": "list_advertisers_affiliate_concentration",
  "mcp_tool": "list_advertisers_affiliate_concentration",
  "status": "approved",
  "source_system": "cake",
  "environment": ["staging", "prod"],
  "sharded": false,
  "connections": {
    "whale": "cake_whale_ro",
    "admin": "cake_admin_ro"
  },
  "objects": [
    "whale.lucos_ro_advertiser_stats_daily",
    "whale.lucos_ro_publisher_earnings_daily",
    "Admin.lucos_ro_adv_campaign_performance_daily",
    "Admin.lucos_ro_advertiser_goals",
    "Admin.lucos_ro_advertiser_categories",
    "Admin.lucos_ro_affiliate_directory"
  ],
  "parameters": {
    "date_from": { "type": "date", "required": false },
    "date_to": { "type": "date", "required": false },
    "limit": { "type": "int", "required": false, "default": 50 }
  },
  "constraints": {
    "max_window_days": 92,
    "default_window_days": 31,
    "max_rows": 50,
    "timeout_ms": 60000
  },
  "allow_fields": [
    "adv_id",
    "adv_name",
    "top_affiliate_id",
    "top_affiliate_name",
    "click_share",
    "revenue_share",
    "clicks",
    "sales_revenue",
    "same_affiliate_for_clicks_and_revenue"
  ],
  "deny_fields": ["rev_share", "aov", "postback_url", "ip"],
  "post_processing": [
    "Calls get_advertiser_report { group_by: publisher } and aggregates in process.",
    "Per advertiser: top affiliate by clicks and by sales_revenue; click_share / revenue_share.",
    "revenue_share is null when advertiser sales_revenue is 0 (CPA / unattributed).",
    "If publisher-grain payload is truncated, refuse (do not compute shares from a truncated set).",
    "Ranked by GREATEST(click_share, COALESCE(revenue_share, 0)). Row-capped at 50."
  ],
  "notes": "Answers 'which advertisers have the highest dependency on a single affiliate' with both traffic and revenue shares. Prefer this over client-side aggregation of publisher rows."
}
