talkops-loki-mcp-server
v0.2.1A Model Context Protocol (MCP) server for Grafana Loki log observability.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
loki_get_labels Get Loki Indexed Labels
List all indexed label names in Grafana Loki over an optional time window. Read-only.
| Parameter | Type | Description |
|---|---|---|
end | End timestamp (RFC3339 or relative like 'now') | |
org_id | Optional tenant ID (X-Scope-OrgID) for multi-tenant Loki | |
start | Start timestamp (RFC3339 or relative like 'now-24h') |
loki_get_label_values Get Loki Label Values
Retrieve values for a specific indexed label in Grafana Loki, optionally scoped by stream selector. Read-only.
| Parameter | Type | Description |
|---|---|---|
label * | string | Indexed label name to retrieve values for (from loki_get_labels) |
end | End timestamp (RFC3339 or relative) | |
org_id | Optional tenant ID (X-Scope-OrgID) for multi-tenant Loki | |
query | Optional LogQL stream selector to scope values (e.g., '{namespace="prod"}') | |
start | Start timestamp (RFC3339 or relative) |
loki_get_series Get Active Loki Log Streams
Return active Loki log stream label sets and per-label cardinality for a stream selector. Read-only.
| Parameter | Type | Description |
|---|---|---|
match * | string | LogQL stream selector (MUST start with '{', e.g., '{app="checkout"}') |
end | End timestamp (RFC3339 or relative) | |
org_id | Optional tenant ID (X-Scope-OrgID) for multi-tenant Loki | |
start | Start timestamp (RFC3339 or relative) |
loki_get_log_patterns Get Loki Log Patterns
Retrieve recurring structural `<_>` log patterns and line counts from Loki's pattern ingester. Read-only.
| Parameter | Type | Description |
|---|---|---|
query * | string | LogQL stream selector (e.g., '{app="checkout"}') |
end | string | End timestamp (RFC3339 or relative) |
org_id | Optional tenant ID (X-Scope-OrgID) for multi-tenant Loki | |
start | string | Start timestamp (RFC3339 or relative) |
loki_get_detected_fields Get Loki Detected Fields
Discover structured metadata, JSON keys, and logfmt fields with types and cardinalities in Loki 3.x streams. Read-only.
| Parameter | Type | Description |
|---|---|---|
query * | string | LogQL stream selector (e.g., '{app="checkout"}') |
end | End timestamp (RFC3339 or relative) | |
field_limit | Max fields to return (default: 1000) | |
line_limit | Max log lines to scan per shard (default: 100) | |
org_id | Optional tenant ID (X-Scope-OrgID) for multi-tenant Loki | |
start | Start timestamp (RFC3339 or relative) |
loki_get_query_stats Get Loki Query Cost Stats
Estimate streams, chunks, entries, and uncompressed bytes touched by a LogQL selector before execution. Read-only.
| Parameter | Type | Description |
|---|---|---|
query * | string | LogQL stream selector wrapped in curly braces (e.g., '{app="checkout"}') |
end | End timestamp (RFC3339 or relative) | |
org_id | Optional tenant ID (X-Scope-OrgID) for multi-tenant Loki | |
start | Start timestamp (RFC3339 or relative) |
loki_query_instant Execute Loki Instant Query
Evaluate a LogQL metric or stream query at a single point in time. Read-only.
| Parameter | Type | Description |
|---|---|---|
query * | string | LogQL query containing a stream selector wrapped in braces (e.g., 'rate({app="checkout"} |= "error" [5m])') |
direction | Sort order: 'forward' or 'backward' (default backward) | |
limit | Maximum log entries (default 100) | |
org_id | Optional tenant ID (X-Scope-OrgID) for multi-tenant Loki | |
time | Evaluation timestamp (RFC3339 or relative). Defaults to 'now'. |
loki_query_range Execute Loki Range Query
Execute a LogQL range query returning log streams or metric time-series matrices with cost guardrails. Read-only.
| Parameter | Type | Description |
|---|---|---|
query * | string | LogQL query containing a stream selector wrapped in braces (e.g., '{app="checkout"} |= "error" | json') |
direction | Sort order: 'forward' or 'backward' (default backward) | |
end | string | End timestamp (RFC3339 or relative like 'now') |
max_log_lines | integer | Max log lines to return for stream queries (default: 100, max: 1000) |
org_id | Optional tenant ID (X-Scope-OrgID) for multi-tenant Loki | |
start | string | Start timestamp (RFC3339 or relative like 'now-1h') |
step | Step for metric queries (e.g., '30s', '5m'). Auto-computed if omitted. |
loki_query_a2ui A2UI Log Table Query
Execute a LogQL range query and flatten results into an interactive A2UI log table payload. Read-only.
| Parameter | Type | Description |
|---|---|---|
query * | string | LogQL stream query formatted with '| json' or '| logfmt' and '| line_format' for A2UI table rendering |
title * | string | The title for the A2UI log table |
end | string | End timestamp (RFC3339 or relative like 'now') |
max_log_lines | integer | Max log lines to return (default: 100). |
org_id | Optional tenant ID (X-Scope-OrgID) | |
start | string | Start timestamp (RFC3339 or relative like 'now-1h') |
loki_summarize_service_logs Summarize Service Logs (N-to-1 Triage)
Compute a high-signal service log health & error summary in one call. Aggregates index stats, total log rate, error rate/ratio, top recurring error signatures, sample error lines, and extracted `trace_id` values for cross-pillar pivoting to Tempo. Read-only.
| Parameter | Type | Description |
|---|---|---|
selector * | string | LogQL stream selector wrapped in braces (e.g., '{app="checkout"}') |
end | string | End timestamp (RFC3339 or relative like 'now') |
error_pattern | string | Regex line filter used to identify error log lines |
org_id | Optional tenant ID (X-Scope-OrgID) | |
sample_limit | integer | Max sample error log lines to include (1-50) |
start | string | Start timestamp (RFC3339 or relative like 'now-1h') |
loki_compare_periods Compare Log Periods or Deployments (N-to-1 Diff)
Compare log volume, error counts, and error signatures across two windows or versions. Detects newly emerging error signatures after a deployment or incident onset without requiring multiple sequential tool calls. Read-only.
| Parameter | Type | Description |
|---|---|---|
selector * | string | Current LogQL stream selector (e.g., '{app="checkout"}') |
baseline_offset | Lookback offset for baseline comparison (e.g., '1h', '24h'). Defaults to '0s' when baseline_selector differs from selector, else '1h'. | |
baseline_selector | Optional distinct baseline selector (e.g., '{app="checkout", version="v1"}') | |
end | string | Current window end (e.g., 'now') |
error_filter | string | Substring or regex filter for error lines (default: 'error') |
org_id | Optional tenant ID (X-Scope-OrgID) | |
start | string | Current window start (e.g., 'now-15m') |
loki_correlate_trace_logs Correlate Logs by Trace or Request ID
Find and chronologically order all logs matching a trace_id or request_id. Enforces Loki cardinality guardrails by querying via structured metadata or line filter (`|= "<correlation_id>"`) outside `{}` stream selectors. Returns participating services and timeline entries for Tempo handoff.
| Parameter | Type | Description |
|---|---|---|
correlation_id * | string | Trace ID, Span ID, or Request ID to search across services (e.g., '4bf92f3577b34da6a3ce929d0e0e4736') |
correlation_key | string | Structured metadata / JSON key name (e.g., 'trace_id', 'request_id', 'span_id') |
end | string | End timestamp (RFC3339 or relative like 'now') |
org_id | Optional tenant ID (X-Scope-OrgID) | |
scope_selector | string | Low-cardinality stream selector scope (never put trace_id in {}) |
start | string | Start timestamp (RFC3339 or relative like 'now-1h') |
loki_analyze_volume Analyze Log Volume & FinOps Attribution
Attribute ingested log bytes and stream counts by label for FinOps optimization. Queries `/loki/api/v1/index/volume` and falls back to `topk(limit, sum by (target_label) (bytes_over_time(...)))` if the Index Volume endpoint is disabled on the Loki backend. Read-only.
| Parameter | Type | Description |
|---|---|---|
query * | string | LogQL stream selector to analyze volume for (e.g., '{namespace="prod"}') |
aggregate_by | string | Aggregation mode for /loki/api/v1/index/volume ('labels' or 'series') |
end | string | End timestamp (RFC3339 or relative like 'now') |
limit | integer | Max top volume series to return (default: 20) |
org_id | Optional tenant ID (X-Scope-OrgID) | |
start | string | Start timestamp (RFC3339 or relative like 'now-6h') |
target_label | string | Label dimension to group byte volume by (e.g., 'app', 'namespace', 'level') |
loki_get_diagnostics Get Loki Backend & Ingestion Diagnostics
Diagnose Loki backend readiness, build version, and discarded log sample reasons. Inspects `/ready`, `/loki/api/v1/status/buildinfo`, and `/metrics` (`loki_discarded_samples_total` by `reason`) to identify rate limiting, stream cardinality limits, or out-of-order/too-old log drops. Read-only.
| Parameter | Type | Description |
|---|---|---|
include_metrics | boolean | Scrape /metrics for loki_discarded_samples_total and ingester chunk counts |
org_id | Optional tenant ID (X-Scope-OrgID) | |
selector | Optional stream selector to check recent 1h index stats for (e.g., '{app="checkout"}') |