Skip to main content
Glama
stonoyan04

grafana-mcp-server

by stonoyan04

query_metrics

Run PromQL or LogQL expressions on Grafana datasources to fetch metrics or logs, with support for instant or range queries.

Instructions

Run a PromQL (Prometheus/Thanos/Mimir) or LogQL (Loki) expression against a datasource through Grafana. Omit from for an instant query; pass from/to for a range query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toNoRange end / instant evaluation time, e.g. "now"now
exprYesPromQL or LogQL expression, e.g. sum by (topic) (increase(kafka_topic_partition_current_offset[7d]))
fromNoRange start, e.g. "now-24h". Omit for an instant query evaluated at `to`.
stepSecondsNoRange-query step in seconds (default 300)
datasourceUidYesDatasource uid (or exact name) from list_datasources
maxDataPointsNoCap on points per series (default 1000)
Behavior2/5

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

With no annotations, the description must disclose behavioral traits such as read-only status or side effects. It only mentions the instant vs. range query modes, but does not state whether the operation is non-destructive, what it returns, or any datasource implications. This leaves the agent to assume safety on a tool that executes arbitrary expressions.

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

Conciseness5/5

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

The description is two sentences with no filler. It front-loads the purpose and then gives a succinct behavioral directive. Every word earns its place, making it easy for an agent to parse quickly.

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

Completeness3/5

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

The description covers the essential query modes and ties to datasources, but omits any mention of return value structure or error handling, which is significant given there is no output schema. The schema documents parameters thoroughly, so the core usage is clear, but the lack of result details leaves a minor gap for such a complex query tool.

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?

The schema fully documents all six parameters with descriptions, so the baseline is 3. The description adds only a rephrased note about omitting `from` for instant queries, which is already present in the schema's `from` field. It adds no new meaning for parameters like `stepSeconds` or `maxDataPoints`.

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?

The description states a precise action: running a PromQL or LogQL expression against a Grafana datasource. It clearly distinguishes this tool from the SQL-oriented sibling (query_sql) by explicitly naming the expression languages, leaving no ambiguity about which tool to use for metric or log queries.

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?

The description explicitly instructs when to omit or include the `from` parameter to switch between instant and range queries, providing clear context for invocation. Though it doesn't explicitly name query_sql as the SQL alternative, the expression-language distinction effectively routes the agent to the correct tool.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/stonoyan04/grafana-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server