Skip to main content
Glama
enrique-pastrana

grafana-mcp-adapter

grafana_query

Query metrics or logs from Grafana datasources using PromQL or LogQL expressions, returning a compact digest or full raw frames.

Instructions

Read-only metric/log query via Grafana's /api/ds/query. Provide the datasource uid (from grafana_list_datasources), a raw expression (PromQL for Prometheus, LogQL for Loki, etc.), and an optional time range. By default returns a compact per-series digest (labels + count/first/last/min/max/avg); pass raw=true for the full (potentially very large) frames.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toNoRange end, e.g. 'now' or epoch ms.now
rawNoReturn the full raw frames instead of the per-series digest. Can be very large.
exprYesQuery expression (PromQL/LogQL/etc.).
fromNoRange start, e.g. 'now-1h' or epoch ms.now-1h
datasource_uidYesDatasource uid from grafana_list_datasources.
max_data_pointsNo
Behavior5/5

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

With no annotations, the description fully discloses read-only nature, potential for large raw frames, and default digest format. This covers safety and size risks.

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?

Three sentences with no wasted words. First sentence states purpose and endpoint, second and third provide usage and behavior. Efficient and front-loaded.

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

Completeness5/5

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

Given no output schema, description explains return format (digest vs raw). Covers all required and optional parameters, references another tool, and mentions query language variations. Complete for a query tool.

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 has 83% description coverage; description adds value by explaining datasource_uid source, expr language types, optional time range, and raw effect. Slight improvement over schema alone.

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 clearly states it is a 'Read-only metric/log query' via a specific API endpoint, with verb 'query' and resource 'metric/log'. It distinguishes from sibling tools like grafana_health or grafana_search_dashboards.

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?

It provides explicit prerequisite (datasource uid from grafana_list_datasources), explains the raw parameter trade-off, and suggests default time range. It does not explicitly say when not to use but gives enough context.

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/enrique-pastrana/grafana-mcp-adapter'

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