prom_metadata
Retrieve metadata for Prometheus metrics to understand available data types, descriptions, and labels for system monitoring.
Instructions
Get metric metadata
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| metric | No | Metric name (optional) |
Implementation Reference
- src/prometheus-client.ts:102-107 (handler)Core handler implementation for prom_metadata tool: queries Prometheus /api/v1/metadata API endpoint with optional 'metric' parameter and returns the response data.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:113-119 (handler)Tool dispatch handler in handleToolCall: validates input arguments and delegates to PrometheusClient.metadata().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)Registers the prom_metadata tool in the tools array with name, description, and input schema for MCP.{ 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 expected input arguments for prom_metadata tool.export interface PromMetadataArgs { metric?: string; }
- src/tools.ts:75-77 (helper)Type guard helper function to validate if arguments match PromMetadataArgs shape.function isPromMetadataArgs(args: unknown): args is PromMetadataArgs { return typeof args === 'object' && args !== null; }