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
| Name | Required | Description | Default |
|---|---|---|---|
| hours | No | ||
| limit | No | ||
| logql | Yes | ||
| target | No |