Skip to main content
Glama
mshegolev

mshegolev/prometheus-mcp

prometheus_query_range

Read-onlyIdempotent

Execute a PromQL range query to retrieve time-series data points over a specified time range and step, enabling historical metric analysis for graphs or incident investigation.

Instructions

Execute a PromQL range query returning time-series data points.

Wraps GET /api/v1/query_range. Returns one series per matching time series, each with labels and a list of [timestamp, value] pairs. Total points across all series are capped at 5000 with a truncation hint.

Prometheus may reject the query with HTTP 422 (bad_data) if the step produces too many data points (> 11,000 per series). Increase the step or narrow the time range if this happens.

Note: The Prometheus API does not support filtering by branch or commit in this endpoint — filters are expressed purely in PromQL label matchers.

Examples: - Use when: "Show me CPU usage over the last hour with 1-minute resolution" → query='rate(node_cpu_seconds_total[5m])', step='1m'. - Use when: "Graph HTTP error rate for the last 24 hours" → query='rate(http_requests_total{status=~"5.."}[5m])', start='2024-01-15T00:00:00Z', end='2024-01-16T00:00:00Z', step='5m'. - Use when: Investigating a past incident — pick the time window of the incident and use a fine step. - Don't use when: You only want the current value (call prometheus_query — faster and simpler). - Don't use when: You want alert history (call prometheus_list_alerts).

Returns: dict with query / start / end / step / result_type / series_count / total_points / truncated / data (list of series with labels, point_count, values).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endYesEnd of range. RFC3339 (e.g. '2024-01-15T11:00:00Z') or Unix timestamp (e.g. '1705316400').
stepYesQuery resolution step. Duration string (e.g. '15s', '1m', '5m') or float seconds (e.g. '30'). Prometheus rejects steps that produce more than 11,000 data points per series.
queryYesPromQL expression to evaluate over a time range. Examples: 'rate(http_requests_total[5m])', 'node_cpu_seconds_total{mode="idle"}'.
startYesStart of range. RFC3339 (e.g. '2024-01-15T10:00:00Z') or Unix timestamp (e.g. '1705312800').
instanceNoTarget instance name (omit for default instance)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
endYes
dataYes
stepYes
queryYes
startYes
truncatedYes
result_typeYes
series_countYes
total_pointsYes
Behavior5/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false. The description adds that it wraps GET /api/v1/query_range, caps total points at 5000 with truncation, notes HTTP 422 rejection for excessive points, and clarifies lack of branch/commit filtering. No contradictions.

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?

Well-structured: purpose first, then details, examples, and returns. Examples are somewhat lengthy but helpful. Could trim slightly, but overall efficient for the complexity.

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?

Given the tool's moderate complexity (5 params, output schema present), the description covers purpose, usage, behavior, error handling, and return format completely. No gaps.

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 coverage is 100% with good descriptions. The description adds value beyond schema by providing concrete query examples, explaining the step limit in context, and mentioning the truncation hint. Not all parameters get extra context, but the addition is meaningful.

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 opens with 'Execute a PromQL range query returning time-series data points,' clearly stating the verb and resource. It distinguishes from sibling tools like prometheus_query (single value) and prometheus_list_alerts by providing explicit usage guidance.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Includes dedicated 'Use when' and 'Don't use when' sections with three positive examples and two negative examples referencing sibling tools. This is explicit, actionable guidance.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mshegolev/prometheus-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server