Preview chart
preview_chartDraw one chart from the user's data and return it as an image, to check it before you save it to a page with edit_page. One metric from one source; with more, a bars stack, more series lines or the high end of a range. Call list_metrics first for the exact names.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"metric": "<metric>",
"provider": "<provider>",
"kind": "<kind>"
},
"name": "preview_chart"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | Last day, YYYY-MM-DD. | |
| days | No | Days back from today. Default 30. | |
| kind | Yes | series: a line over time. bars: one bar per day. figure: the newest value. calendar: a day grid. range: a low to high bar per day. table: one row per metric and one column per day, newest first, each value as stored with its unit (text values too); lab results also show the printed flag and range. A table takes several devices and units in one row: use it for lab results. dots: one row per lab result, the newest reading as a dot on the lab's printed range, older readings as rings, flagged values in the chart colour; set start and end to cover the lab reports. | |
| more | No | series: up to 3 more lines, any source, same unit (Oura and Garmin HRV). bars: up to 3 more metrics of the same source, stacked (sleep stages). range: one, the high end (metric is the low end). table and dots: up to 59 more rows of the same source, in display order (lab results). With no provider, provider and device are the cell's. | |
| unit | No | Draw the values in this unit, only when the user asks for one. Stored values do not change. | |
| color | No | The chart's colour. Default orange. | |
| label | No | The name of this line or layer in the legend, in the user's words ("Light", "Deep"). Leave it out for one line. In a table, the row's name in the user's words and language ("LDL cholesterol"); left out, the row shows the name the source printed. | |
| start | No | First day, YYYY-MM-DD. With end, in place of days. | |
| title | No | ||
| device | No | One device of that source, when list_metrics shows several. | |
| metric | Yes | One metric, as list_metrics names it. | |
| formula | No | Only when the user asks for their own score or calculation: a formula drawn in place of the metrics. The page keeps the formula; each view computes its values, and freddy stores none of them. a is metric, b to d are more in order (with a formula, more takes any source and unit; one value per day each). Numbers, + - * /, brackets, min(x, y), max(x, y), avg(a, N) = mean of the N days before (N up to 90). Kinds series, bars, figure, calendar; no unit. | |
| provider | Yes | Its source, as list_metrics names it. |