Skip to main content
Glama
mshegolev/prometheus-mcp

mshegolev/prometheus-mcp

prometheus_map_service_dependencies

Read-onlyIdempotent

Map service-to-service dependencies from live Prometheus traffic metrics to discover call paths and identify high-error edges during incidents.

Instructions

Map service-to-service dependencies from live Prometheus traffic metrics.

Aggregates rate(<metric>[<window>]) by (source_label, destination_label) via query_range and turns each returned series into a directed dependency edge (nodes = services, edge weight = mean request rate). No simulation — every node/edge comes from real series. When error_matcher is supplied a second query derives a per-edge error rate.

Use this to:

  • Discover which services call which, and how heavily.

  • Spot high-error dependencies during an incident.

Examples: - "Map dependencies for the prod namespace over the last 15 minutes" → matchers={"namespace": "prod"}, time_window="15m". - "Which edges are erroring?" → error_matcher='response_code=~"5.."'.

Returns: ServiceDependencyMapResult with nodes and directed edges (sorted by throughput), plus the query parameters used.

Input Schema

NameRequiredDescriptionDefault
stepNoquery_range resolution step (e.g. '30s', '1m'). Default '1m'.1m
metricNoTraffic counter carrying source/destination labels. Defaults to Istio's 'istio_requests_total'. For other meshes/instrumentation set this plus source_label/destination_label (e.g. metric='request_total', source_label='source', destination_label='destination').istio_requests_total
instanceNoTarget instance name (omit for default instance).
matchersNoOptional extra label matchers to scope the query, e.g. {"namespace": "prod"}. Values are escaped against PromQL injection.
time_windowNoLook-back window for the rate() (e.g. '5m', '1h'). Default '5m'.5m
source_labelNoMetric label whose value identifies the calling service (edge source).source_workload
error_matcherNoOptional PromQL matcher fragment selecting error traffic, e.g. 'response_code=~"5.."'. When set, each edge gains an error_rate.
destination_labelNoMetric label whose value identifies the called service (edge target).destination_workload

Output Schema

NameRequiredDescriptionDefault
stepYes
edgesYes
nodesYes
metricYes
instanceYes
edge_countYes
node_countYes
time_windowYes
source_labelYes
error_matcherYes
destination_labelYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.5.1

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent and openWorld, so the safety profile is covered; the description adds meaningful behavior beyond them — that error_matcher triggers a second query and adds per-edge error_rate, that results are sorted by throughput, and that query parameters are echoed back. It doesn't discuss cost/timeouts of running two range queries over large windows, but the value-add is solid.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose, then mechanism, use cases, examples and return shape in a scannable structure. Slightly verbose with RST double-backtick markup and some overlap between the intro paragraph and the example block, but nothing is wasted.

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

Completeness5/5

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

With 8 optional parameters, 100% schema coverage, an output schema, and full annotations, the description covers purpose, mechanism, examples, and result shape without needing to re-document fields. An agent has everything required to call it correctly.

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

Parameters4/5

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

Schema description coverage is 100%, so the baseline is 3, and the description earns extra credit by demonstrating real usage: matchers={"namespace": "prod"} for scoping and error_matcher='response_code=~"5.."' for error selection, plus the explanation of how metric/source_label/destination_label work together for non-Istio meshes.

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 opening sentence names a specific verb and resource ('Map service-to-service dependencies from live Prometheus traffic metrics') and the body explains the mechanism (aggregating rate() by source/destination labels into directed edges). It clearly distinguishes itself from the generic query siblings like prometheus_query and prometheus_query_range by producing a derived graph rather than raw series.

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?

The 'Use this to' bullets plus two concrete examples give clear situational guidance (namespace scoping, incident triage of erroring edges), and 'No simulation — every node/edge comes from real series' sets expectations. It stops short of explicitly naming an alternative tool (e.g. use prometheus_query_range for raw series), so the when-not-to-use case is only implied.

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