get_session_events
Extract and filter session events by type or time range to analyze user behavior. Retrieve detailed data for insights into clicks, inputs, errors, and custom interactions.
Instructions
Get all events from a session with optional filtering by event type
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endTime | No | End timestamp (ms) | |
| eventTypes | No | Filter by specific event types (CLICK, INPUT, LOCATION, CUSTOM, ERROR, etc.) | |
| sessionId | Yes | The session ID | |
| startTime | No | Start timestamp (ms) |
Implementation Reference
- src/index.ts:392-404 (handler)The handler function that executes the tool: extracts sessionId, calls OpenReplay API to get events, returns JSON stringified response.private async getSessionEvents(args: any) { const { sessionId } = args; const response = await this.api.get(`/api/v1/${OPENREPLAY_PROJECT_KEY}/sessions/${sessionId}/events`); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; }
- src/index.ts:124-137 (schema)Input schema definition for the get_session_events tool, defining parameters like sessionId (required), eventTypes, startTime, endTime.inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "The session ID" }, eventTypes: { type: "array", items: { type: "string" }, description: "Filter by specific event types (CLICK, INPUT, LOCATION, CUSTOM, ERROR, etc.)" }, startTime: { type: "number", description: "Start timestamp (ms)" }, endTime: { type: "number", description: "End timestamp (ms)" } }, required: ["sessionId"] }
- src/index.ts:121-138 (registration)Tool registration in the listTools handler: defines name, description, and input schema.{ name: "get_session_events", description: "Get all events from a session with optional filtering by event type", inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "The session ID" }, eventTypes: { type: "array", items: { type: "string" }, description: "Filter by specific event types (CLICK, INPUT, LOCATION, CUSTOM, ERROR, etc.)" }, startTime: { type: "number", description: "Start timestamp (ms)" }, endTime: { type: "number", description: "End timestamp (ms)" } }, required: ["sessionId"] } },
- src/index.ts:282-283 (registration)Dispatch/registration in the CallToolRequestSchema switch statement, routing to the handler.case "get_session_events": return await this.getSessionEvents(args);