query_loki_logs
Run a LogQL range query to retrieve logs from Grafana Loki, filtered by time range and direction.
Instructions
Run a Loki range query through Grafana datasource proxy.
Args:
query: LogQL expression, e.g. {app="myservice"} |= "error".
limit: Maximum number of log lines to return (1–5000, default 100).
direction: "backward" (newest first, default) or "forward".
start: Start of the time range. RFC 3339 or Unix nanosecond string.
end: End of the time range. RFC 3339 or Unix nanosecond string.
Returns: JSON payload from Loki with streams and log entries.
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": {
"query": "<query>"
},
"name": "query_loki_logs"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | ||
| limit | No | ||
| query | Yes | ||
| start | No | ||
| direction | No | backward |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||