anomaly-check
Anomaly Check
Run a quiet health check on one property and speak only when something needs a human. It is meant for a scheduler: it calls no write tool, works with a read-only connection, and its quiet-case reply is one fixed line so a log stays readable. The user's request may contain a property (or several, checked one after another with the same rules), a cadence (daily or weekly; daily is the default) and a metric to focus on; nothing else is needed.
Workflow
-
Resolve the property. If the user's request or the conversation names a property, use it. Site URLs use GSC formats:
sc-domain:example.comorhttps://www.example.com/. Otherwise calllist_sitesand pick the obvious match. If several plausible properties exist, ask the user which one before continuing; a scheduled run with no clear match reports that as its finding. GSC data lags about 2 to 3 days: the tools end at the latest settled date, so the check window is the last 7 settled days for a daily run and the last 14 for a weekly one; never treat the most recent 2 days as complete. -
Single-day anomalies. Call
detect_anomalieswithmetric: "clicks",days: 28(minimum 21) and the defaultsensitivity(3.5; the range is 2 to 6 and lower finds more). Repeat withmetric: "impressions".- Keep only
anomalieswhosedatefalls inside the check window; readseverity(critical,high,medium,low,info),direction(upordown),actual,expectedanddeviationPercent. summarycarries the counts per severity.coverage.zeroFilledDayssays how many days had no rows at all; a drop to zero is flagged, which is also what a data gap looks like.
- Keep only
-
Level shift. Call
detect_change_pointswithmetric: "clicks",days: 60and the defaultsensitivityof 2.- Read
changePoints(date,direction,beforeMean,afterMean,changePercent) and keep entries dated within the last 14 days. - When
countis 0,trendSummary.directionandtrendSummary.ratiodescribe the slope. A gradual slide is not a finding for this check, but mention it in a weekly run whenratiois below 0.8.
- Read
-
Week over week. Call
get_site_summarywithdays: 7(days: 14for a weekly run).- Compare
currentwithpreviousonclicksandimpressions; derive the percentage change yourself and say so. ctris already a percentage on a 0-100 scale, never multiply it by 100;avgPositionis lower-is-better, so a move toward a lower number is an improvement.
- Compare