Skip to main content
Glama
mgcrea

@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 window, to discover what metrics or streams you can 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.

Input Schema

NameRequiredDescriptionDefault
endNoWindow end: now, now-1h, -30m, 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, 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. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already cover read-only and open-world, so the bar is lower; the description adds real value by disclosing the default one-hour window versus the datasource's whole-retention default, which is a genuine surprise-avoidance detail. It also documents the `__name__` special case for Prometheus. It does not mention result limits or cost of broad selectors, which would have earned a 5.

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, then mode-switching, then scoping, then the default-window caveat. Dense but every clause carries information; the em-dash construction is slightly heavy but not wasteful.

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?

Seven optional parameters, all schema-documented, and the description covers mode selection, scoping, and time defaults — enough for correct invocation. Since there is no output schema, a brief note on the returned shape (flat list vs. paginated) would have closed the remaining gap.

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; the description goes further by explaining the semantic switch on `label` (absent = names, present = values, `__name__` = metric names) and giving a concrete `selector` example. It leaves `limit`, `search`, and `end` entirely to the schema, which is acceptable given full coverage.

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 (discover/list label names and values) scoped to Prometheus or Loki datasources, and immediately distinguishes the two modes via `label`. An agent can tell this apart from grafana_query / grafana_query_prometheus, which fetch data rather than metadata, without opening any schema.

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?

Gives clear conditional usage: omit `label` to enumerate label names, supply it to enumerate values, and use `selector` to narrow to relevant series/streams. The time-window guidance ('looks at the last hour unless start is given') is a concrete usage rule. It stops short of naming an explicit alternative tool or stating when-not to use it.

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