Detect metric anomalies
detect_metric_anomaliesFlag days when one personal-health metric deviates sharply from its usual baseline, using a robust median/MAD z-score to catch spikes or dips in noisy short series.
Instructions
Flag days where one metric deviated sharply from its own baseline over the window, using a median/MAD-based modified z-score rather than a mean/stdev z-score — more robust for short, noisy personal-health series, where the mean/stdev version is easily dragged around by the very outliers it's supposed to catch.
Use this tool when:
the user asks whether anything looked unusual/off/weird on particular days for one metric (e.g. "was there anything unusual about my sleep last month?").
Do not use this tool when:
the user wants a general sense of what's typical, with no interest in flagging specific days -> use
get_baselineinstead.the user asks about a steady increase/decrease over time rather than isolated spikes/dips -> use
calculate_metric_trendinstead.the user already has one specific date in mind and wants the full "why" behind it (baseline, anomaly, trend, and correlations together) -> use
explain_metric_changeinstead.
Privacy note: this server and its SQLite file are entirely local, but the data returned by this tool becomes part of the conversation sent to whatever model the calling client is configured with. If that model runs in the cloud rather than on your machine, treat this the same as pasting the data into a chat with that provider.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| metric | Yes | One of steps, sleep_hours, resting_heart_rate, weight_kg, workout_minutes, mood, water_ml, heart_rate, hrv_ms. | |
| end_date | No | Last day to include, formatted YYYY-MM-DD. Defaults to today. | |
| threshold | No | Modified z-score cutoff. 3.5 (the default, Iglewicz & Hoaglin's standard value) flags only clear outliers; lower it (e.g. 2.5) to see more borderline days. | |
| start_date | No | First day to include, formatted YYYY-MM-DD. Defaults to 90 days before end_date. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| claim | Yes | Evidence and decision for the anomaly claim; read claim.decision before reporting it. | |
| range | Yes | ||
| metric | Yes | ||
| evidence | Yes | DEPRECATED: identical to claim.evidence. Use claim.decision, not evidence.confidence. | |
| anomalies | Yes | ||
| threshold | Yes |