Skip to main content
Glama
AIops-tools

observability-aiops

loki_query

Execute validated LogQL queries against Loki within a capped lookback and line limit, returning truncated results that indicate partial coverage for reliable log investigation.

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
Behavior5/5

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

With no annotations, the description fully discloses behavioral traits: it is read-only ('[READ]'), validation-gated, imposes a required stream selector, caps lookback and line count, and returns an envelope with 'returned'/'limit'/'truncated' including guidance on re-running if truncated. This goes beyond a basic description and informs the agent of constraints and partial-result handling.

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 concise yet structured: a one-line summary, a note on the stream selector requirement, a compact args list, and a return-behavior note. Every sentence adds value and there is no redundancy or fluff. The formatting (bold summary, args list) aids scanning.

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?

For a query tool with 4 parameters and no output schema, this description is complete: it covers constraints, usage, and return semantics. It explains what 'truncated' means and how to handle partial results. No critical behavioral aspect is missing, making it sufficient for an agent to select and invoke the tool correctly.

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?

The input schema has 0% description coverage, but the description thoroughly compensates by explaining each parameter: logql (with example), hours (capped), limit (clamped), and target (config reference, default). It adds meaning, constraints, and defaults beyond the schema, making the tool actionable.

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 this is a 'Bounded LogQL query_range passthrough' with specific constraints (stream selector required, capped lookback, clamped line count). It distinguishes itself from sibling tools like loki_tail_errors and loki_labels by focusing on range queries over log streams. The verb 'query' and resource 'Loki' are explicit.

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 provides clear context that this is for bounded LogQL range queries with a mandatory stream selector, and notes that unbounded queries are rejected. It does not explicitly name alternatives or describe when-not-to-use, but the context implies its use case. No exclusions or alternates are given, though the sibling list contains loki_tail_errors, loki_labels, etc.

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/AIops-tools/Observability-AIops'

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