Skip to main content
Glama
@mgcrea/mcp-grafana

@mgcrea/mcp-grafana

by mgcrea

Grafana: List Labels

grafana_list_labels
Read-only

List label names or values for Prometheus and Loki datasources, filtered by selector and time range, to discover what series or streams to query.

Instructions

Discover what to query, for a Prometheus or Loki datasource: with no label, the label names in use; with label, the values it takes (label=name lists Prometheus metric names). Restrict with selector to the series or streams that matter, e.g. the pods of one namespace. Looks at the last hour unless start is given — the datasource default is its whole retention, which returns everything that ever existed.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "grafana_list_labels"
  }
}

Input Schema

NameRequiredDescriptionDefault
endNoWindow end: now, now-1h, -30m, now/d or now-1d/d (rounded in UTC: a start to the start of the day, an end to its end), an RFC3339 timestamp (2026-01-31T12:00:00Z) or unix seconds/ms. Defaults to now.
labelNoA label name, e.g. "namespace", or "__name__" for Prometheus metric names. Omit to list label names.
limitNoMaximum values (1-10000). Defaults to 500.
startNoWindow start: now, now-1h, -30m, now/d or now-1d/d (rounded in UTC: a start to the start of the day, an end to its end), an RFC3339 timestamp (2026-01-31T12:00:00Z) or unix seconds/ms. Defaults to now-1h.
searchNoCase-insensitive substring to filter by, e.g. `nginx`.
selectorNoA series or stream selector to restrict to, e.g. `{namespace="monitoring"}` or, for Prometheus, a metric name like `kube_pod_info`. A selector only, no functions.
datasourceNoDatasource uid or name, e.g. "prometheus" or "Loki". Defaults to the default datasource. grafana_list_datasources lists them.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.2.0
    • changedInput schema / properties / end / description
      Previous value: -"Window end: now, now-1h, -30m, an RFC3339 timestamp (2026-01-31T12:00:00Z) or unix seconds/ms. Defaults to now."New value: +"Window end: now, now-1h, -30m, now/d or now-1d/d (rounded in UTC: a start to the start of the day, an end to its end), an RFC3339 timestamp (2026-01-31T12:00:00Z) or unix seconds/ms. Defaults to now."
    • changedInput schema / properties / start / description
      Previous value: -"Window start: now, now-1h, -30m, an RFC3339 timestamp (2026-01-31T12:00:00Z) or unix seconds/ms. Defaults to now-1h."New value: +"Window start: now, now-1h, -30m, now/d or now-1d/d (rounded in UTC: a start to the start of the day, an end to its end), an RFC3339 timestamp (2026-01-31T12:00:00Z) or unix seconds/ms. Defaults to now-1h."
  2. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and openWorldHint, so the safety profile is covered; the description adds a genuinely non-obvious behavioral fact — the tool looks at the last hour by default while the datasource default is full retention, which would return everything ever recorded. It also notes selectors accept no functions. It says nothing about result size or the `limit` interaction, but the core surprise is disclosed.

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 core behavior and mode split, then scope restriction, then the temporal default caveat. Dense but every sentence contributes; the nested em-dash clauses make it slightly harder to scan than a clean bulleted phrasing would be.

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 a 7-parameter, annotation-backed read tool with no output schema, the description covers modes, scoping, and the time-window pitfall, which is what an agent needs to call it correctly. It could note that multiple datasources require an explicit `datasource` or that results are capped by `limit`, but nothing critical is missing.

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

Parameters3/5

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

Schema description coverage is 100%, so all seven parameters are already documented, including the `label`/`__name__` trick and the start/end formats. The description reinforces the label-mode semantics and the time-window consequence but adds little syntax or meaning the schema doesn't already carry, so the high-coverage baseline of 3 applies.

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 (discover) and resource (labels) for Prometheus/Loki and explains the two operating modes precisely: no `label` yields label names, `label` yields that label's values, with `label=__name__` giving metric names. This clearly separates it from the query siblings (grafana_query_prometheus, grafana_query_loki), which fetch data rather than metadata.

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

Usage Guidelines4/5

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

"Discover what to query" establishes this as a pre-query exploration step, and the selector guidance ("restrict to the series or streams that matter, e.g. the pods of one namespace") tells the agent how to narrow scope. It does not explicitly name an alternative tool or state when not to use it, so it stops short of full routing guidance.

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