Skip to main content
Glama
mcp-loki

mcp-loki

by mgcrea

Loki: List Detected Fields

loki_list_detected_fields
Read-only

Lists 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

NameRequiredDescriptionDefault
endNoRange end: now, now-1h, -30m, an RFC3339 timestamp (2026-01-31T12:00:00Z, nanosecond fractions kept) or unix seconds/nanoseconds. Defaults to now.
fieldNoA field name from a previous call, e.g. `status`, to list its values.
limitNoMaximum fields or values to return (1-1000). Defaults to 100.
queryYesA stream selector, optionally with line filters, e.g. `{app="api"}` or `{app="api"} |= "error"`. Fields are sampled from the matching lines.
startNoRange 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.
searchNoCase-insensitive substring to filter by, e.g. `api`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.2/5.0
Behavior4/5

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

With readOnlyHint and openWorldHint already supplied, the description adds meaningful context about the operation's output and its sampling scope over the streams a query selects. It does not discuss cardinality accuracy, result limits, or performance characteristics, which would have pushed it higher for an exploratory tool.

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?

Two sentences, both front-loaded with the key facts: what is listed and why. The example pipeline (`| json | status >= 500`) earns its place by making the tool's purpose immediately concrete.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, so the description carries the return-value burden and does so by naming type, cardinality, and parser per field. Combined with the rich input schema, an agent has enough to call it correctly, though the exact response structure remains unstated.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents query, time range, limit, search, and the `field` mode. The description's mention of passing `field` to get values largely restates the schema's own description of that parameter and adds little syntax or format detail beyond it, fitting the baseline 3.

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 names a specific verb and resource: listing the fields Loki can extract from log lines (JSON keys, logfmt keys, structured metadata). It goes beyond the title by enumerating what is returned (type, cardinality, parser) and clearly separates this from label-oriented siblings like loki_list_labels.

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?

It gives a clear when-to-use rationale: learn what to write after `| json` or `| logfmt` without reading raw lines first. It also explains the alternate mode via `field`. It stops short of naming sibling tools or stating when not to use it, so it is strong but not exhaustive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.