Skip to main content
Glama
lekt9

OpenReplay MCP Server

by lekt9

get_user_sessions

Retrieve user session data from OpenReplay by specifying a user ID and optional date range to analyze behavior patterns and interactions.

Instructions

Get sessions for a specific user ID (API key authentication supported)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userIdYesThe user ID to get sessions for
startDateNoStart date in ISO format
endDateNoEnd date in ISO format

Implementation Reference

  • The handler function that implements the logic for the 'get_user_sessions' tool. It extracts userId, optional startDate and endDate from args, makes an authenticated API GET request to OpenReplay's /users/{userId}/sessions endpoint with date params converted to timestamps, and returns the JSON response as MCP content.
    private async getUserSessions(args: any) {
      const { userId, startDate, endDate } = args;
      const response = await this.api.get(`/api/v1/${OPENREPLAY_PROJECT_KEY}/users/${userId}/sessions`, {
        params: {
          start_date: startDate ? new Date(startDate).getTime() : undefined,
          end_date: endDate ? new Date(endDate).getTime() : undefined
        }
      });
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(response.data, null, 2),
          },
        ],
      };
    }
  • Input schema defining the parameters for the 'get_user_sessions' tool: required 'userId' (string), optional 'startDate' and 'endDate' (ISO strings).
    inputSchema: {
      type: "object",
      properties: {
        userId: { type: "string", description: "The user ID to get sessions for" },
        startDate: { type: "string", description: "Start date in ISO format" },
        endDate: { type: "string", description: "End date in ISO format" }
      },
      required: ["userId"]
    }
  • src/index.ts:63-75 (registration)
    Registration of the 'get_user_sessions' tool in the MCP server's list of available tools, including name, description, and input schema.
    {
      name: "get_user_sessions",
      description: "Get sessions for a specific user ID (API key authentication supported)",
      inputSchema: {
        type: "object",
        properties: {
          userId: { type: "string", description: "The user ID to get sessions for" },
          startDate: { type: "string", description: "Start date in ISO format" },
          endDate: { type: "string", description: "End date in ISO format" }
        },
        required: ["userId"]
      }
    },
  • src/index.ts:276-277 (registration)
    Dispatcher case in the CallToolRequestSchema handler that routes calls to the 'get_user_sessions' handler method.
    case "get_user_sessions":
      return await this.getUserSessions(args);
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. It adds value by specifying 'API key authentication supported', which is useful behavioral context not in the schema. However, it lacks details on rate limits, pagination, error handling, or what 'sessions' entail, leaving gaps in transparency.

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 with zero wasted words. It front-loads the core purpose and includes authentication details concisely, making it easy to parse quickly.

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 no annotations and no output schema, the description is minimal but covers the basic purpose and authentication. For a tool with three parameters and session data retrieval, it should ideally explain return values or data scope, but it's adequate as a starting point.

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 fully documents all three parameters. The description adds no additional parameter semantics beyond what's in the schema, such as format examples or constraints, meeting the baseline for high 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 verb 'Get' and resource 'sessions for a specific user ID', making the purpose unambiguous. However, it doesn't differentiate from sibling tools like 'get_session_details' or 'search_sessions', which likely retrieve similar session-related data, so it misses the highest score.

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 such as 'get_session_details' or 'search_sessions'. It mentions API key authentication, but this is more about behavioral context than usage timing, leaving the agent without clear selection criteria.

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