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);

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