Skip to main content
Glama
yanmxa

Prometheus MCP Server

by yanmxa

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
NameRequiredDescriptionDefault
metricNoMetric name (optional)

Implementation Reference

  • 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; }
  • 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)' }, }, }, }, {
  • TypeScript interface defining the expected input arguments for prom_metadata tool.
    export interface PromMetadataArgs { metric?: string; }
  • Type guard helper function to validate if arguments match PromMetadataArgs shape.
    function isPromMetadataArgs(args: unknown): args is PromMetadataArgs { return typeof args === 'object' && args !== null; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yanmxa/prometheus-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server