prom_metadata
Retrieve detailed metadata for Prometheus metrics to understand available data, analyze system performance, and streamline monitoring workflows.
Instructions
Get metric metadata
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| metric | No | Metric name (optional) |
Implementation Reference
- src/tools.ts:113-119 (handler)Handler logic for the prom_metadata tool: validates arguments and delegates to PrometheusClient.metadata method.case 'prom_metadata': { if (!isPromMetadataArgs(args)) { throw new Error('Invalid arguments for prom_metadata'); } const { metric } = args as PromMetadataArgs; result = await prometheusClient.metadata(metric); break;
- src/tools.ts:44-54 (registration)Registration of the prom_metadata tool in the tools array, including name, description, and input schema.{ name: 'prom_metadata', description: 'Get metric metadata', inputSchema: { type: 'object', properties: { metric: { type: 'string', description: 'Metric name (optional)' }, }, }, }, {
- src/types.ts:24-26 (schema)TypeScript interface defining the input arguments for prom_metadata tool.export interface PromMetadataArgs { metric?: string; }
- src/prometheus-client.ts:102-107 (helper)Core implementation of metadata query in PrometheusClient, which makes the API call to /api/v1/metadata.async metadata(metric?: string): Promise<PrometheusResponse<Record<string, MetricMetadata[]>>> { const params: Record<string, string> = {}; if (metric) params.metric = metric; const response = await this.client.get<PrometheusResponse<Record<string, MetricMetadata[]>>>('/api/v1/metadata', { params }); return response.data; }
- src/tools.ts:75-77 (helper)Type guard function to validate arguments for prom_metadata tool.function isPromMetadataArgs(args: unknown): args is PromMetadataArgs { return typeof args === 'object' && args !== null; }