Skip to main content
Glama
stonoyan04

grafana-mcp-server

by stonoyan04

query_sql

Run raw SQL queries against ClickHouse, Postgres, MySQL, or MSSQL through Grafana and retrieve result rows. Use datasource UID from list_datasources to specify the target.

Instructions

Run raw SQL against a SQL-family datasource (ClickHouse, Postgres, MySQL, MSSQL) through Grafana and get rows back. Use list_datasources first to get the uid. Read-only by convention — use a Viewer credential.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toNoRange end, e.g. "now"now
sqlYesThe SQL to run. Use the database column names, e.g. snake_case, not the app-level ones.
fromNoRange start for $__timeFilter-style macros, e.g. "now-30d" or epoch msnow-6h
datasourceUidYesDatasource uid (or exact name) from list_datasources
Behavior3/5

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

With no annotations, the description carries the burden of behavioral disclosure. It mentions read-only by convention and returning rows, which is helpful, but omits other traits like error handling, rate limits, or potential side effects beyond the stated convention. It adds some value but is not comprehensive.

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 exactly two sentences with no redundant words. The core purpose is front-loaded, and the usage note follows immediately, making it easy to scan and internalize.

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 raw SQL tool with a straightforward purpose, the description covers purpose, prerequisites, and read-only behavior. It does not detail time-range semantics (covered in schema) or return size limits, but given the tool's nature and lack of output schema, it is sufficiently complete for an agent to call it correctly.

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 the schema already documents all parameters. The description does not add new parameter-level detail; it only reinforces the datasourceUid dependency on list_datasources, which is already in the schema. Baseline 3 is appropriate.

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 the tool runs raw SQL against SQL-family datasources and returns rows, using specific verbs (run) and resources (SQL datasource). It distinctively positions itself from siblings like query_metrics by emphasizing 'raw SQL' and explicit datasource family names.

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 gives a clear prerequisite ('Use list_datasources first to get the uid') and notes a read-only convention. However, it does not explicitly compare with alternatives such as query_metrics or state when not to use this tool, leaving selection to inference.

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