Skip to main content
Glama

prometheus_label_values

Retrieve all values for a specified Prometheus label to streamline metric analysis and monitoring. This tool enables precise querying and enhances integration with monitoring infrastructure.

Instructions

Get all values for a specific Prometheus label

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelYeslabel name to get values for

Implementation Reference

  • Tool handler for 'prometheus_label_values': takes client and args, calls client.getLabelValues(args.label). This is the direct implementation of the MCP tool execution logic.
    defineTool<typeof PrometheusLabelValuesSchema, LabelValues>({ capability: "discovery", name: "prometheus_label_values", title: "Get Label Values", description: "Get all values for a specific Prometheus label", inputSchema: PrometheusLabelValuesSchema, type: "readonly", handle: async (client: PrometheusClient, args) => client.getLabelValues(args.label), }),
  • Zod input schema for the prometheus_label_values tool, defining the required 'label' parameter.
    const PrometheusLabelValuesSchema = z.object({ label: z.string().describe("label name to get values for"), });
  • Core helper method in PrometheusClient that performs the HTTP GET request to Prometheus API endpoint /api/v1/label/{label}/values to fetch label values.
    async getLabelValues(label: string): Promise<LabelValues> { const endpoint = `/api/v1/label/${encodeURIComponent(label)}/values`; return this.request<LabelValues>(endpoint); }
  • The tool definition is added to the exported 'tools' array for registration in the MCP server.
    defineTool<typeof PrometheusLabelValuesSchema, LabelValues>({ capability: "discovery", name: "prometheus_label_values", title: "Get Label Values", description: "Get all values for a specific Prometheus label", inputSchema: PrometheusLabelValuesSchema, type: "readonly", handle: async (client: PrometheusClient, args) => client.getLabelValues(args.label), }),

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/idanfishman/prometheus-mcp'

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