Skip to main content
Glama
mgcrea

@mgcrea/mcp-grafana

by mgcrea

Grafana: Run Panel Query

grafana_run_panel_query
Read-only

Run 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

NameRequiredDescriptionDefault
toNoRange end: now, now-1h, -30m, an RFC3339 timestamp (2026-01-31T12:00:00Z) or unix seconds/ms. Defaults to the dashboard's time.to.
uidYesThe dashboard uid, e.g. "alertmanager-overview" (from grafana_search or a /d/<uid>/ URL).
fromNoRange start: now, now-1h, -30m, an RFC3339 timestamp (2026-01-31T12:00:00Z) or unix seconds/ms. Defaults to the dashboard's time.from.
sortNoOrder 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
varsNoVariable 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.
viewNoFor 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
limitNoMaximum series, log lines or table rows per query (1-1000). Defaults to 30.
pointsNoTarget 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_idYesThe panel id, from grafana_get_dashboard (or `viewPanel=` in a dashboard URL), e.g. 4.
precisionNoSignificant digits to round fractional values to (whole numbers are never rounded). Defaults to 4; 0 returns the exact value.
max_line_charsNoCut each log line at this many characters (50-20000). Defaults to 1000.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only cover readOnly/openWorld, yet the description discloses the real behavioral contract: variable resolution precedence (vars > dashboard-saved > first value/All), that hidden queries and expressions are honored, that the variable values used and each query as sent are returned for verification, and the per-shape output format (grid+stats / lines / table). No output schema exists, so this disclosure is doing essential work.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the action and return contract, and every sentence carries information. It is dense but slightly overpacked in one paragraph, and the closing note on the default time range partially repeats the schema's from/to documentation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 11-param tool with a nested `vars` object and no output schema, the description covers return format, variable resolution and defaults well. It stops short of error behavior (unknown panel id, non-query panels) and any permission caveats, which would be the remaining useful additions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3, but the description adds genuine semantics beyond the schema: the three-tier fallback for unfilled template variables and the default time range behavior. These explain how `vars` and the `from`/`to` omission actually behave, not just their formats.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: "Run a dashboard panel's queries ... and return the data", with the panel-scoped framing that separates it from raw query siblings like grafana_query_prometheus or grafana_query. The added clause about template variables and hidden queries makes the operation's boundaries unmistakable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description makes the usage context clear (reproduce what the dashboard would show, re-run with other values) and notes the default time range, but never names an alternative or states when to prefer grafana_query_prometheus/grafana_query instead of a panel query. Usage is implied by the panel framing rather than spelled out as routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.