Skip to main content
Glama
AIops-tools

observability-aiops

loki_query

Read-only

Run bounded LogQL range queries against Loki with required stream selectors, capped lookback, and clamped line limits to return partial or complete log results.

Instructions

[READ] Bounded LogQL query_range passthrough (validation-gated).

The query MUST carry a stream selector (e.g. '{app="api"}') — an unbounded query with no selector is rejected. Lookback is capped and the line count is clamped.

Args: logql: A LogQL query with a stream selector (e.g. '{job="api"} |= "error"'). hours: Lookback window in hours (capped at the tool's max lookback). limit: Max log lines to return (clamped to the tool's max line limit). target: Loki target name from config; omit for the default.

Returns an envelope with returned/limit/truncated. If truncated is true the result is partial — re-run with a higher limit.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hoursNo
limitNo
logqlYes
targetNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.7.0

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the readOnlyHint annotation, it discloses real operational behavior: the stream-selector validation gate, a capped lookback, a clamped line limit, and truncation semantics with the recommended remediation. That is exactly the extra context annotations cannot carry.

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?

Front-loaded with purpose, then Args, then Returns in clearly labeled blocks; no sentence is filler. The truncation caveat is placed where an agent will act on it.

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?

With no output schema, the description supplies the return envelope (returned/limit/truncated) and interprets the truncated flag, and it covers every input parameter plus the hard validation constraint. Nothing needed to invoke or interpret the call is missing.

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

Parameters5/5

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

Schema description coverage is 0%, so the description carries the whole burden — and it does: logql (with a concrete example and the selector requirement), hours (lookback, capped), limit (max lines, clamped), and target (config name, omit for default). All four parameters are explained with meaning beyond their names.

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 opening line states a specific verb and resource — a bounded LogQL query_range passthrough — plus the two distinguishing traits (validation-gated, bounded). It is immediately separable from siblings like loki_tail_errors or log_volume_analysis, which are curated analyses rather than a raw query passthrough.

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 gives the gating condition (a stream selector is mandatory; unbounded queries are rejected) and follow-up guidance (re-run with a higher limit when truncated). It does not, however, name when to prefer this over sibling log tools or state any exclusions, so it stops short of full when/when-not guidance.

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