Skip to main content
Glama
agarwalvivek29

OpenTelemetry MCP Server

list_log_labels

Discover available log stream labels in Loki for filtering and troubleshooting. Use this tool to identify labels that help narrow down log searches and investigate issues.

Instructions

List all log stream labels in Loki. Use this to discover what labels are available for filtering.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startNoStart time for label discovery
endNoEnd time for label discovery

Implementation Reference

  • The implementation of the `list_log_labels` tool handler which calls the Loki client to retrieve log labels.
    async def list_log_labels(
        client: LokiClient,
        start: Optional[str] = None,
        end: Optional[str] = None
    ) -> Dict[str, Any]:
        """
        List all log stream labels.
        
        Args:
            client: Loki client
            start: Start time for label discovery
            end: End time for label discovery
            
        Returns:
            List of label names
        """
        try:
            # Parse time range if provided
            start_ns = None
            end_ns = None
            if start or end:
                start_dt, end_dt = parse_time_range(start, end)
                start_ns = to_loki_time(start_dt)
                end_ns = to_loki_time(end_dt)
            
            result = await client.labels(start_ns, end_ns)
            
            if result.get("status") == "success":
                labels = result.get("data", [])
                return {
                    "success": True,
                    "count": len(labels),
                    "labels": labels
                }
            else:
                return {
                    "success": False,
                    "error": "Failed to fetch labels"
                }
        except Exception as e:
            logger.error(f"Error listing log labels: {e}")
            return {
                "success": False,
                "error": str(e)
            }

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