Calculate metric trend
calculate_metric_trendAnalyze if a health or finance metric is trending up, down, or flat over a date range by fitting a straight line and reporting slope and r-squared.
Instructions
Fit a simple straight-line trend to one metric over a window and report its direction, slope (change per day), and r_squared (how well a straight line actually fits — low r_squared means "noisy," not "flat").
Use this tool when:
the user asks whether one metric is trending up/down/flat over a continuous window (e.g. "is my weight trending down?", "how has my HRV changed?").
Do not use this tool when:
the user wants two specific, separately-defined ranges compared (e.g. "this month vs last month") rather than a single continuous slope -> use
compare_metric_periodsinstead.the user asks what's typical/normal rather than which direction it's moving -> use
get_baselineinstead.the user asks about isolated unusual days rather than an overall direction -> use
detect_metric_anomaliesinstead.
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. | |
| start_date | No | First day to include, formatted YYYY-MM-DD. Defaults to 30 days before end_date. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| claim | Yes | Evidence and decision for the trend claim; read claim.decision before reporting it. | |
| range | Yes | ||
| trend | Yes | ||
| metric | Yes | ||
| evidence | Yes | DEPRECATED: identical to claim.evidence. Use claim.decision, not evidence.confidence. |