Skip to main content
Glama
sunshinerich

grafana-log-mcp

by sunshinerich

query_slow_logs

Fetch slow logs by duration threshold across SQL, request, or connection dimensions. Automatically retrieve original SQL statements and aggregate statistics for large result sets.

Instructions

按耗时阈值抓取慢日志(如执行超过 30s 的慢 SQL)。支持三个维度:sql(每条 SQL 的 queryRows/updateRows Nms)、request(请求级 utime)、connection(连接级 release)。慢 SQL 自动按连接号-序号配对回捞语句原文;命中超 30 条(如循环任务)时自动按操作聚合统计(count/totalMs/maxMs/avgMs),明细仅保留最慢样本。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endNo
kindNo耗时维度,默认 sql
levelNo
limitNo
minMsNo耗时阈值(毫秒),默认 30000
rangeNo默认 15m
startNo
labelsNo
keywordNo
projectNo
withSqlNo慢 SQL 是否回捞语句原文,默认 true(仅最慢前 10 条)
maxPagesNo
requestIdNo
datasourceUidNo
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses key behavioral traits: automatic pairing of slow SQL statements by connection-order, aggregation when >30 rows, and that only the slowest samples are kept in detail. This goes beyond a simple 'retrieve slow logs' and is honest about non-obvious behavior. Does not contradict any annotations.

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?

The description is compact and front-loaded with the core functionality. However, it packs multiple behavioral details into one long sentence, which could be slightly reorganized. Still, each sentence earns its place by covering distinct aspects: threshold, dimensions, auto-pairing, and aggregation.

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?

Given the tool's complexity (14 params, no output schema, no annotations), the description covers the main behaviors well but leaves gaps: no mention of default values for many parameters, no explanation of the return structure, and no guidance on how parameters like 'start'/'end' interplay with 'range'. It's adequate for basic use but not complete for advanced configurations.

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

Parameters2/5

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

Schema description coverage is only 29%, meaning 10 of 14 parameters lack descriptions. The description adds meaning to 'kind' (dimensions), 'minMs' (threshold), 'withSql' (statement retrieval), but does not explain other parameters like 'end', 'level', 'limit', 'range', 'start', 'labels', 'keyword', 'project', 'maxPages', 'requestId', 'datasourceUid'. With a low coverage, the description should compensate more, but it leaves many parameters ambiguous.

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 explicitly states the tool fetches slow logs by duration threshold, gives an example (SQL >30s), and enumerates three dimensions (sql/request/connection). This distinguishes it clearly from sibling tools like query_logs (general log querying) and trace_flow (tracing).

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 gives specific contexts for use: threshold-based slow log retrieval, dimensional variety, and aggregation behavior for >30 hits. It does not explicitly mention when not to use this tool vs alternatives, but the detailed context is clear enough for an agent to select it appropriately.

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/sunshinerich/grafana-log-mcp'

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