Skip to main content
Glama
sunshinerich

grafana-log-mcp

by sunshinerich

query_logs

Retrieve raw logs from Grafana/Loki with filters like request ID, keyword, time range, and level. Enforces volume limits to avoid oversized results; ideal for focused forensic evidence gathering during troubleshooting.

Instructions

查询原始日志。数据量控制:优先用 requestId 精确到单次请求;配合窄时间窗(默认 15m);行数/单行长度/总响应均有硬上限,超出会标注省略。排查线上问题建议优先用 diagnose_issue(自动聚合分析),本工具适合按线索精确取证。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endNo绝对结束时间 RFC3339
levelNoerror / warn / info / debug
limitNo每批行数上限,默认 200,最大 1000
rangeNo时间窗,默认 15m。数据量大时务必配合 requestId/keyword 或收窄窗口
startNo绝对开始时间 RFC3339,如 2026-08-18T14:20:00+08:00
labelsNo未登记项目的标签,如 {"app":"xxx"}
keywordNo日志文本关键词(子串匹配)
projectNo项目 key 或中文别名
maxPagesNo翻页批数,默认 4;总行数上限 = limit × maxPages,超出会提示
directionNo默认 backward(最新在前)
requestIdNo请求/链路 ID,精确过滤单次请求的日志(强烈推荐,可极大减少返回量)
extraLabelsNo追加的流标签过滤,如 {"host":"pod-1"}
datasourceUidNo
Behavior4/5

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

With zero annotations, the description carries the full burden and largely delivers: it discloses hard caps on rows/line length/total response, indicates truncation markers ('超出会标注省略'), and reveals the platform's protective limits. Slight gap: doesn't explicitly state read-only safety, rate limits, or failure behavior.

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, each earning its place: purpose, volume-control strategy, and when-to-use vs alternative. Front-loaded and telegraphic, no fluff. The semicolon-delimited hard-cap list packs maximum information density per character.

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 high-complexity tool (13 params, no output schema, no annotations), the description covers the critical operational concern (data volume) thoroughly, including defaults and caps, and points to how to avoid hitting limits. Could add error/auth comments or output format hints, but the volume story—the main pitfall for log queries—is well told.

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 coverage is 92%, so per rubric the baseline is 3 and the schema already documents per-parameter meaning well (e.g., requestId 'strongly recommended', range default, maxPages formula). The description adds cross-parameter strategy (combine requestId + narrow time window) which is genuinely useful but mostly reinforces rather than extends schema semantics.

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?

Starts with a specific verb+resource ('Query raw logs') and immediately distinguishes scope. The closing sentence explicitly contrasts with diagnose_issue ('automatic aggregate analysis' vs 'precise evidence following clues'), which disambiguates from siblings and reinforces purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly names diagnose_issue as the preferred tool for production troubleshooting, and positions this tool ('suitable for...') for clue-based evidence collection. Also gives concrete operational guidance (use requestId, pair with narrow time windows, default 15m) that tells the agent when and how to invoke correctly.

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