Loki: List Detected Fields
loki_list_detected_fieldsLists fields Loki can extract from selected log streams—JSON keys, logfmt keys, and structured metadata—with type, cardinality, and parser, or lists a field's values.
Instructions
List the fields Loki can pull out of the log lines themselves — JSON keys, logfmt keys and structured metadata — with their type, cardinality and which parser finds them, for the streams a query selects. This is how to learn what to write after | json or | logfmt (e.g. | json | status >= 500) without reading lines first. Pass field to get that field's values instead.
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": "loki_list_detected_fields"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | Range end: now, now-1h, -30m, an RFC3339 timestamp (2026-01-31T12:00:00Z, nanosecond fractions kept) or unix seconds/nanoseconds. Defaults to now. | |
| field | No | A field name from a previous call, e.g. `status`, to list its values. | |
| limit | No | Maximum fields or values to return (1-1000). Defaults to 100. | |
| query | Yes | A stream selector, optionally with line filters, e.g. `{app="api"}` or `{app="api"} |= "error"`. Fields are sampled from the matching lines. | |
| start | No | Range start: now, now-1h, -30m, an RFC3339 timestamp (2026-01-31T12:00:00Z, nanosecond fractions kept) or unix seconds/nanoseconds. Defaults to 1 hour before end. | |
| search | No | Case-insensitive substring to filter by, e.g. `api`. |