loki_query
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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"logql": "<logql>"
},
"name": "loki_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hours | No | ||
| limit | No | ||
| logql | Yes | ||
| target | No |