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
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | prometheus query expression | |
| start | Yes | start timestamp (RFC3339 or unix timestamp) | |
| end | Yes | end timestamp (RFC3339 or unix timestamp) | |
| step | Yes | query resolution step width |
Implementation Reference
- src/server/tools.ts:186-187 (handler)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),
- src/server/tools.ts:57-62 (schema)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"), });
- src/server/tools.ts:179-188 (registration)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), }),