prometheus_metric_metadata
Retrieve detailed metadata for a specified Prometheus metric to enable precise monitoring and analysis within the Prometheus-MCP server environment.
Instructions
Get metadata for a specific Prometheus metric
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| metric | Yes | metric name to get metadata for |
Implementation Reference
- src/server/tools.ts:64-66 (schema)Zod schema defining the input parameters for the prometheus_metric_metadata tool (metric name).const PrometheusMetricMetadataSchema = z.object({ metric: z.string().describe("metric name to get metadata for"), });
- src/server/tools.ts:104-113 (registration)Tool registration: defines and registers the prometheus_metric_metadata tool in the tools array, including its inline handler that delegates to PrometheusClient.getMetricMetadata.defineTool<typeof PrometheusMetricMetadataSchema, MetricMetadata>({ capability: "discovery", name: "prometheus_metric_metadata", title: "Get Metric Metadata", description: "Get metadata for a specific Prometheus metric", inputSchema: PrometheusMetricMetadataSchema, type: "readonly", handle: async (client: PrometheusClient, args) => client.getMetricMetadata(args.metric), }),
- src/prometheus/client.ts:182-186 (handler)Core handler logic: executes HTTP GET request to Prometheus /api/v1/metadata endpoint with metric parameter to retrieve metric metadata.async getMetricMetadata(metric: string): Promise<MetricMetadata> { const endpoint = "/api/v1/metadata"; const params: Record<string, string> = { metric }; return this.request<MetricMetadata>(endpoint, params); }