Skip to main content
Glama
yanmxa

Prometheus MCP Server

by yanmxa

prom_range

Execute PromQL range queries to retrieve time-series metrics between specified start and end timestamps with defined step intervals for monitoring and analysis.

Instructions

Execute a PromQL range query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesPromQL query expression
startYesStart timestamp
endYesEnd timestamp
stepYesStep interval (e.g., "15s", "1m")
includesNoMetric properties to include in response (optional)

Implementation Reference

  • Core implementation of prom_range: sends HTTP GET to Prometheus /api/v1/query_range endpoint with parameters and filters results if includes specified.
    async range(query: string, start: string, end: string, step: string, includes?: string[]): Promise<PrometheusResponse<QueryResult>> {
      const response = await this.client.get<PrometheusResponse<QueryResult>>('/api/v1/query_range', {
        params: { query, start, end, step },
        timeout: 30000,
      });
      
      if (response.data.data && includes) {
        response.data.data = this.filterQueryResult(response.data.data, includes);
      }
      
      return response.data;
    }
  • Input schema definition for the prom_range tool used in MCP tool registration.
    inputSchema: {
      type: 'object',
      properties: {
        query: { type: 'string', description: 'PromQL query expression' },
        start: { type: 'string', description: 'Start timestamp' },
        end: { type: 'string', description: 'End timestamp' },
        step: { type: 'string', description: 'Step interval (e.g., "15s", "1m")' },
        includes: { type: 'array', items: { type: 'string' }, description: 'Metric properties to include in response (optional)' },
      },
      required: ['query', 'start', 'end', 'step'],
    },
  • src/tools.ts:24-38 (registration)
    Tool object registration for prom_range in the exported tools array.
    {
      name: 'prom_range',
      description: 'Execute a PromQL range query',
      inputSchema: {
        type: 'object',
        properties: {
          query: { type: 'string', description: 'PromQL query expression' },
          start: { type: 'string', description: 'Start timestamp' },
          end: { type: 'string', description: 'End timestamp' },
          step: { type: 'string', description: 'Step interval (e.g., "15s", "1m")' },
          includes: { type: 'array', items: { type: 'string' }, description: 'Metric properties to include in response (optional)' },
        },
        required: ['query', 'start', 'end', 'step'],
      },
    },
  • Dispatch handler in handleToolCall function that validates args and invokes prometheusClient.range for prom_range tool.
    case 'prom_range': {
      if (!isPromRangeArgs(args)) {
        throw new Error('Invalid arguments for prom_range');
      }
      const { query, start, end, step, includes } = args;
      result = await prometheusClient.range(query, start, end, step, includes);
      break;
  • Type guard helper to validate PromRangeArgs input for the prom_range tool.
    function isPromRangeArgs(args: unknown): args is PromRangeArgs {
      return typeof args === 'object' && args !== null && 
        'query' in args && 'start' in args && 'end' in args && 'step' in args;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It states what the tool does but doesn't describe what happens during execution - whether it's read-only, whether it requires authentication, potential rate limits, error conditions, or what the response format looks like. For a query execution tool with zero annotation coverage, this is inadequate.

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?

The description is extremely concise - just four words that directly state the tool's function. There's zero wasted language, and it's front-loaded with the essential information. Every word earns its place.

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

Completeness2/5

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

For a query execution tool with 5 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what a 'range query' means versus other query types, what the tool returns, or any behavioral characteristics. The agent would need to guess about the output format and appropriate usage context.

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 all parameters are documented in the schema. The description adds no additional parameter information beyond what's already in the schema properties. The baseline of 3 is appropriate when the schema does all the parameter documentation work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Execute') and resource ('PromQL range query'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'prom_query' - both appear to execute queries, so the distinction between 'range query' and regular query isn't explained.

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

Usage Guidelines2/5

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

The description provides no guidance about when to use this tool versus alternatives. With sibling tools like 'prom_query' and 'prom_discover' available, there's no indication of when a range query is appropriate versus other query types or discovery operations. No prerequisites or exclusions are mentioned.

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/yanmxa/prometheus-mcp-server'

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