Skip to main content
Glama
dimonb

Uptrace MCP Server

by dimonb

uptrace_search_groups

Search and aggregate spans using GROUP BY operations with functions like count(), avg(), and p99() to analyze trace data in Uptrace.

Instructions

Search and aggregate spans by groups. Supports GROUP BY operations and aggregations like count(), avg(), p99(), etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
time_gteYesStart time in ISO format (YYYY-MM-DDTHH:MM:SSZ)
time_ltYesEnd time in ISO format (YYYY-MM-DDTHH:MM:SSZ)
queryYesUQL query with grouping (e.g., 'group by service_name | count()')
limitNoMaximum number of groups to return (default: 100)

Implementation Reference

  • The handler for the uptrace_search_groups tool, which processes the input arguments, calls the Uptrace client, and returns the result.
    elif name == "uptrace_search_groups":
        try:
            time_gte = parse_datetime(arguments["time_gte"])
            time_lt = parse_datetime(arguments["time_lt"])
        except (KeyError, ValueError) as e:
            return [TextContent(type="text", text=f"Error: {str(e)}")]
    
        query = arguments.get("query")
        limit = arguments.get("limit", 100)
    
        if not query:
            return [TextContent(type="text", text="Error: query is required")]
    
        logger.info(f"Querying groups: {query}")
        result = client.query_spans_groups(
            time_gte=time_gte, time_lt=time_lt, query=query, limit=limit
        )
    
        import json
    
        return [
            TextContent(
                type="text",
                text=f"# Groups Query Results\n\n```json\n{json.dumps(result, indent=2)}\n```",
            )
        ]
  • The schema definition for the uptrace_search_groups tool.
    Tool(
        name="uptrace_search_groups",
        description="Search and aggregate spans by groups. Supports GROUP BY operations and aggregations like count(), avg(), p99(), etc.",
        inputSchema={
            "type": "object",
            "properties": {
                "time_gte": {
                    "type": "string",
                    "description": "Start time in ISO format (YYYY-MM-DDTHH:MM:SSZ)",
                },
                "time_lt": {
                    "type": "string",
                    "description": "End time in ISO format (YYYY-MM-DDTHH:MM:SSZ)",
                },
                "query": {
                    "type": "string",
                    "description": "UQL query with grouping (e.g., 'group by service_name | count()')",
                },
                "limit": {
                    "type": "integer",
Behavior3/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 supported aggregation functions (count, avg, p99) which adds context, but fails to disclose safety characteristics (read-only vs destructive), rate limits, pagination behavior beyond the limit parameter, or return value structure.

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 consists of two efficient sentences with zero waste. It front-loads the core action ('Search and aggregate spans by groups') before detailing capabilities, making it immediately scannable for an agent selecting tools.

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 100% schema coverage, the description adequately covers the tool's conceptual purpose. However, lacking both annotations and an output schema, the description should ideally disclose the return format (aggregated groups vs individual spans) and safety profile (read-only) to be complete.

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?

Schema description coverage is 100%, establishing a baseline of 3. The description mentions 'GROUP BY operations' and aggregation examples that align with the 'query' parameter's UQL format, but does not add significant semantic meaning beyond what the schema already provides for time formats or limit behavior.

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

Purpose5/5

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

The description clearly states the tool 'Search[es] and aggregate[s] spans by groups', providing specific verbs (search, aggregate), resource (spans), and method (grouping). It effectively distinguishes from sibling uptrace_search_spans by emphasizing aggregation/GROUP BY operations versus raw span retrieval.

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?

While the description implies this tool is for aggregated analysis (mentioning GROUP BY and aggregation functions), it provides no explicit guidance on when to use this versus uptrace_search_spans (raw spans) or uptrace_query_metrics (metrics). No 'when-not-to-use' or prerequisites are stated.

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/dimonb/uptrace-mcp'

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