get_user_sessions
Retrieve user sessions by ID within a specified date range using API key authentication. Supports analysis of session data for insights into user behavior and interaction patterns.
Instructions
Get sessions for a specific user ID (API key authentication supported)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endDate | No | End date in ISO format | |
| startDate | No | Start date in ISO format | |
| userId | Yes | The user ID to get sessions for |
Implementation Reference
- src/index.ts:327-344 (handler)The handler function that executes the get_user_sessions tool by making an API call to OpenReplay to fetch sessions for a given user ID, with optional date range.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), }, ], }; }
- src/index.ts:63-75 (schema)The tool schema definition including name, description, and input schema for get_user_sessions.{ 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)The switch case that registers and dispatches the get_user_sessions tool call to its handler.case "get_user_sessions": return await this.getUserSessions(args);