analysis_anomalies_check
Detect campaign anomalies by comparing current metrics against a historical baseline. Returns severity-ordered alerts for zero spend, CPA spikes, and CTR drops, gated by minimum data thresholds.
Instructions
Detect anomalies for one campaign by comparing its current metrics against a median-based baseline built from STATE.json's action_log history. Returns severity-ordered anomalies — zero spend (CRITICAL), CPA spike (HIGH/CRITICAL, gated by 30+ conversions), CTR drop (HIGH/CRITICAL, gated by 1000+ impressions). No baseline is produced when history < min_baseline_entries (default 7).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| current | Yes | Point-in-time metrics for the campaign. | |
| state_file | No | Path to STATE.json. Resolved inside the server's current working directory; traversal or symlink escape is rejected. Defaults to 'STATE.json'. | |
| had_prior_spend | No | Set false for fresh campaigns that have never spent. Suppresses the zero-spend alert in that case. | |
| min_baseline_entries | No | Minimum action_log entries required to build a baseline. Default 7 (one week). Below this the tool returns baseline=null and evaluates only zero-spend. |