Skip to main content
Glama
lekt9

OpenReplay MCP Server

by lekt9

aggregate_sessions

Analyze user session data by calculating metrics like duration, error rates, and page views, grouped by time periods, devices, or locations to identify behavioral patterns.

Instructions

Aggregate session data with various metrics and groupings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startDateNoStart date in ISO format
endDateNoEnd date in ISO format
metricsYesMetrics to calculate
groupByNoFields to group by
filtersNoSame filter format as search_sessions

Implementation Reference

  • The handler function that implements the logic for the 'aggregate_sessions' tool. Currently, it returns a message indicating that aggregation is not supported via API key authentication.
    private async aggregateSessions(args: any) {
      // Aggregation requires access to the full sessions/search endpoint
      // which is not available via API key authentication
      return {
        content: [
          {
            type: "text",
            text: "Session aggregation is not available via API key authentication. You can retrieve individual user sessions instead.",
          },
        ],
      };
    }
  • The input schema definition for the 'aggregate_sessions' tool, specifying parameters like startDate, endDate, metrics, groupBy, and filters.
    inputSchema: {
      type: "object",
      properties: {
        startDate: { type: "string", description: "Start date in ISO format" },
        endDate: { type: "string", description: "End date in ISO format" },
        metrics: {
          type: "array",
          description: "Metrics to calculate",
          items: {
            type: "string",
            enum: ["count", "avg_duration", "error_rate", "bounce_rate", "unique_users", "page_views"]
          }
        },
        groupBy: {
          type: "array",
          description: "Fields to group by",
          items: {
            type: "string",
            enum: ["hour", "day", "week", "browser", "device", "country", "page", "error_type"]
          }
        },
        filters: { type: "array", description: "Same filter format as search_sessions" }
      },
      required: ["metrics"]
  • src/index.ts:139-167 (registration)
    The tool registration in the listTools response, including name, description, and input schema for 'aggregate_sessions'.
    {
      name: "aggregate_sessions",
      description: "Aggregate session data with various metrics and groupings",
      inputSchema: {
        type: "object",
        properties: {
          startDate: { type: "string", description: "Start date in ISO format" },
          endDate: { type: "string", description: "End date in ISO format" },
          metrics: {
            type: "array",
            description: "Metrics to calculate",
            items: {
              type: "string",
              enum: ["count", "avg_duration", "error_rate", "bounce_rate", "unique_users", "page_views"]
            }
          },
          groupBy: {
            type: "array",
            description: "Fields to group by",
            items: {
              type: "string",
              enum: ["hour", "day", "week", "browser", "device", "country", "page", "error_type"]
            }
          },
          filters: { type: "array", description: "Same filter format as search_sessions" }
        },
        required: ["metrics"]
      }
    },
  • The dispatch case in the CallToolRequest handler that routes to the aggregateSessions method.
    case "aggregate_sessions":
      return await this.aggregateSessions(args);
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It states the tool aggregates data but doesn't mention whether this is a read-only operation, if it requires specific permissions, how results are returned (e.g., pagination, format), or any rate limits. For an aggregation tool with multiple parameters and no annotations, this leaves significant behavioral gaps.

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 a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part ('aggregate session data,' 'various metrics and groupings') contributes directly to understanding the tool's function. There's no redundancy or fluff, making it highly concise and well-structured.

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 complexity (5 parameters, aggregation functionality) and lack of annotations and output schema, the description is minimally adequate. It covers the basic purpose but misses behavioral details, usage context, and output expectations. For a tool that likely returns aggregated data sets, more information on result format or limitations would improve completeness, but the schema provides good parameter coverage.

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%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema by implying the tool handles 'various metrics and groupings,' which aligns with the metrics and groupBy parameters. However, it doesn't provide additional context like examples of common groupings or how filters relate to search_sessions. Baseline 3 is appropriate given high schema coverage.

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 tool's purpose as aggregating session data with metrics and groupings, using specific verbs ('aggregate') and resources ('session data'). It distinguishes from siblings like get_session_details or get_session_events by focusing on aggregation rather than retrieval of individual records. However, it doesn't explicitly differentiate from get_performance_metrics which might also involve aggregated data.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like get_performance_metrics, search_sessions, or execute_custom_query. It mentions 'various metrics and groupings' but doesn't specify contexts, prerequisites, or exclusions. Without this, an agent might struggle to choose between this and other analytical tools.

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/lekt9/openreplay-mcp'

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