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)
            }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool lists labels for 'filtering' but doesn't describe key behaviors like whether it's read-only, how it handles time ranges (start/end parameters), potential rate limits, or what the output looks like (e.g., list format). This leaves significant gaps for an agent to understand the tool's operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two concise sentences with zero waste: the first states the purpose, and the second provides usage context. It's front-loaded with the core action and efficiently conveys essential information without unnecessary details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (2 optional parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and usage but lacks details on behavior, output format, and error handling. For a discovery tool in a logging context, more context on what 'labels' represent or how results are structured would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with clear documentation for 'start' and 'end' parameters. The description doesn't add any parameter-specific semantics beyond what the schema provides, such as explaining time format or default behavior. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'List' and resource 'all log stream labels in Loki', making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_labels' or 'list_label_values', which likely have overlapping functionality in the same Loki context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance by stating 'Use this to discover what labels are available for filtering', which suggests when to use it (for discovery before filtering). However, it doesn't explicitly state when not to use it or name alternatives among the sibling tools, leaving some ambiguity about tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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