{
  "id": "get_datafeed_traffic_report",
  "mcp_tool": "get_datafeed_traffic_report",
  "status": "approved",
  "source_system": "cake",
  "environment": ["staging", "prod"],
  "sharded": false,
  "connections": {
    "whale": "cake_whale_ro"
  },
  "objects": [
    "whale.lucos_ro_advertiser_stats_daily"
  ],
  "parameters": {
    "traffic_id": { "type": "string", "required": false },
    "product_tag": { "type": "string", "required": false },
    "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": [
    "affiliate_id",
    "affiliate_name",
    "clicks",
    "affiliate_earning",
    "campaign_count",
    "traffic_id",
    "traffic_name"
  ],
  "deny_fields": ["ip", "redirect_url", "postback_url", "rev_share", "sales_revenue"],
  "post_processing": [
    "Resolve datafeed product tags from lucos_ro_traffic_channels (name/id match datafeed|xml feed, or caller traffic_id).",
    "Collect campaign_id from lucos_ro_campaign_product_targeting for those tags (MNGT RO, cap 2000 per tag).",
    "Aggregate whale.lucos_ro_advertiser_stats_daily by affiliate_id WHERE show_oos=0 AND camp_id IN that set. Rank by clicks. Chunk camp_id IN at 400. Do not use Admin.lucos_ro_affiliate_cpc_summary_daily — that view times out on a 31-day camp IN.",
    "If the requested window exceeds its time limit and is longer than 7 days, retry the last 7 days and set window_shortened.",
    "This is whale advertiser_stats clicks on datafeed-tagged campaigns — same clicks_source as get_advertiser_report, not CPC earnings, not IVT, not click-level URLs/IPs."
  ],
  "notes": "PREFERRED for 'which affiliate has more datafeed traffic'. Do not rank all Cake clicks or IVT valid_clicks as a substitute. Do not use list_traffic_channels / list_campaigns_by_product_tag as volume. Default last 31 days, max 92. Row-capped at 50 affiliates. summary is the unbounded affiliate total for the tagged campaign set."
}
