Skip to main content
Glama
agarwalvivek29

OpenTelemetry MCP Server

list_label_values

Retrieve all values for a specific label like 'service' or 'namespace' to discover monitored services and namespaces in your OpenTelemetry environment.

Instructions

Get all values for a specific label. Common labels: 'service', 'job', 'namespace', 'instance'. Use this to discover what services/namespaces are monitored.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelYesLabel name to get values for (e.g., 'service', 'job', 'namespace')
metricNoOptional metric name to filter label values

Implementation Reference

  • The core implementation of the list_label_values tool handler in prometheus_tools.py.
    async def list_label_values(
        client: PrometheusClient,
        label: str,
        metric: Optional[str] = None
    ) -> Dict[str, Any]:
        """
        Get all values for a specific label.
        
        Args:
            client: Prometheus client
            label: Label name (e.g., 'service', 'job', 'namespace')
            metric: Optional metric to filter label values
            
        Returns:
            List of label values
        """
        try:
            match = [f"{{{metric}}}"] if metric else None
            result = await client.label_values(label, match)
            
            if result.get("status") == "success":
                values = result.get("data", [])
                return {
                    "success": True,
                    "label": label,
                    "count": len(values),
                    "values": values
                }
            else:
                return {
                    "success": False,
                    "error": "Failed to fetch label values"
                }

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/agarwalvivek29/opentelemetry-mcp'

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