prom_query
Execute PromQL instant queries to retrieve real-time Prometheus metrics for system monitoring and performance analysis.
Instructions
Execute a PromQL instant query
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | PromQL query expression | |
| time | No | Evaluation timestamp (optional) | |
| includes | No | Metric properties to include in response (optional) |
Implementation Reference
- src/tools.ts:93-99 (handler)Handler logic for 'prom_query' tool: validates input arguments using isPromQueryArgs and executes the query via prometheusClient.query.case 'prom_query': { if (!isPromQueryArgs(args)) { throw new Error('Invalid arguments for prom_query'); } const { query, time, includes } = args; result = await prometheusClient.query(query, time, includes); break;
- src/tools.ts:11-23 (registration)Registration of the 'prom_query' tool in the exported tools array, defining name, description, and input schema.{ name: 'prom_query', description: 'Execute a PromQL instant query', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'PromQL query expression' }, time: { type: 'string', description: 'Evaluation timestamp (optional)' }, includes: { type: 'array', items: { type: 'string' }, description: 'Metric properties to include in response (optional)' }, }, required: ['query'], }, },
- src/types.ts:10-14 (schema)TypeScript interface defining the expected arguments for prom_query, matching the input schema.export interface PromQueryArgs { query: string; time?: string; includes?: string[]; }
- src/tools.ts:66-68 (helper)Type guard helper function to validate if arguments match PromQueryArgs structure.function isPromQueryArgs(args: unknown): args is PromQueryArgs { return typeof args === 'object' && args !== null && 'query' in args; }