Grafana: Run Panel Query
grafana_run_panel_queryRun a dashboard panel's queries as Grafana would, resolving template variables and respecting datasource, hidden queries, and expressions, then return data with variables and queries used.
Instructions
Run a dashboard panel's queries the way the dashboard would, and return the data: template variables ($namespace, ${datasource}) are filled in — from vars, else the value saved with the dashboard, else the variable's first value (or All) as the browser would pick — and the panel's datasource, hidden queries and expressions are respected. Returns the variable values used and each query as sent, so the result can be checked and re-run with other values. Time series come back on a step grid with stats, logs as lines, anything else as a table. The time range defaults to the dashboard's own (often now-1h).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Range end: now, now-1h, -30m, an RFC3339 timestamp (2026-01-31T12:00:00Z) or unix seconds/ms. Defaults to the dashboard's time.to. | |
| uid | Yes | The dashboard uid, e.g. "alertmanager-overview" (from grafana_search or a /d/<uid>/ URL). | |
| from | No | Range start: now, now-1h, -30m, an RFC3339 timestamp (2026-01-31T12:00:00Z) or unix seconds/ms. Defaults to the dashboard's time.from. | |
| sort | No | Order of time series, applied before `limit` cuts: labels keeps the datasource's order; max/avg/last rank highest first, so a cut keeps the biggest. | labels |
| vars | No | Variable values by name, without the $, e.g. {"namespace": "monitoring", "pod": ["a", "b"]}. "All" or "$__all" selects All. A datasource variable takes a uid or name. | |
| view | No | For time series. values: stats (min/max/avg/last) plus one value per step on a shared grid given by start and step, null where there was no sample. stats: the stats only, about a tenth of the size — use it to survey many series before reading a few. | values |
| limit | No | Maximum series, log lines or table rows per query (1-1000). Defaults to 30. | |
| points | No | Target points per series (2-1000), from which the step is picked. Defaults to 60; a dashboard in a browser asks for ~1000, which is rarely worth the tokens. | |
| panel_id | Yes | The panel id, from grafana_get_dashboard (or `viewPanel=` in a dashboard URL), e.g. 4. | |
| precision | No | Significant digits to round fractional values to (whole numbers are never rounded). Defaults to 4; 0 returns the exact value. | |
| max_line_chars | No | Cut each log line at this many characters (50-20000). Defaults to 1000. |