Skip to main content
Glama
idanfishman

prometheus-mcp

by idanfishman

prometheus_query_range

Execute Prometheus range queries to retrieve time-series metrics data between specified start and end timestamps with defined resolution steps.

Instructions

Execute a Prometheus range query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesprometheus query expression
startYesstart timestamp (RFC3339 or unix timestamp)
endYesend timestamp (RFC3339 or unix timestamp)
stepYesquery resolution step width

Implementation Reference

  • Handler function that executes the prometheus_query_range tool by calling the PrometheusClient's queryRange method with the provided query, start, end, and step parameters.
    handle: async (client: PrometheusClient, args) =>
      client.queryRange(args.query, args.start, args.end, args.step),
  • Zod input schema defining parameters for the prometheus_query_range tool: query (string), start (string), end (string), step (string).
    const PrometheusQueryRangeSchema = z.object({
      query: z.string().describe("prometheus query expression"),
      start: z.string().describe("start timestamp (RFC3339 or unix timestamp)"),
      end: z.string().describe("end timestamp (RFC3339 or unix timestamp)"),
      step: z.string().describe("query resolution step width"),
    });
  • Registration of the prometheus_query_range tool using defineTool, specifying capability, name, title, description, input schema, type, and handler. This object is included in the exported tools array.
    defineTool<typeof PrometheusQueryRangeSchema, QueryResult>({
      capability: "query",
      name: "prometheus_query_range",
      title: "Prometheus Query Range",
      description: "Execute a Prometheus range query",
      inputSchema: PrometheusQueryRangeSchema,
      type: "readonly",
      handle: async (client: PrometheusClient, args) =>
        client.queryRange(args.query, args.start, args.end, args.step),
    }),

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

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