get_user_journey
Track and analyze user interactions across multiple sessions by providing a User ID and date range. Optionally include detailed events for comprehensive behavioral insights.
Instructions
Get the complete journey of a user across multiple sessions
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endDate | No | End date in ISO format | |
| includeEvents | No | Include detailed events (default false) | |
| startDate | No | Start date in ISO format | |
| userId | Yes | User ID or anonymous ID |
Implementation Reference
- src/index.ts:419-437 (handler)The main handler function for the 'get_user_journey' tool. It extracts userId and date parameters from args, calls the OpenReplay API to fetch user sessions, and returns the JSON response as text content.private async getUserJourney(args: any) { const { userId, startDate, endDate } = args; // Use the v1 API user sessions endpoint const response = await this.api.get(`/api/v1/${OPENREPLAY_PROJECT_KEY}/users/${userId}/sessions`, { params: { start_date: startDate ? new Date(startDate).getTime() : Date.now() - 30 * 24 * 60 * 60 * 1000, end_date: endDate ? new Date(endDate).getTime() : Date.now() } }); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; }
- src/index.ts:171-180 (schema)The input schema defining the parameters for the get_user_journey tool: userId (required), startDate, endDate, includeEvents.inputSchema: { type: "object", properties: { userId: { type: "string", description: "User ID or anonymous ID" }, startDate: { type: "string", description: "Start date in ISO format" }, endDate: { type: "string", description: "End date in ISO format" }, includeEvents: { type: "boolean", description: "Include detailed events (default false)" } }, required: ["userId"] }
- src/index.ts:286-287 (registration)The switch case in the tool call handler that dispatches to the getUserJourney method.case "get_user_journey": return await this.getUserJourney(args);
- src/index.ts:168-181 (registration)The tool registration in the listTools response, including name, description, and inputSchema.{ name: "get_user_journey", description: "Get the complete journey of a user across multiple sessions", inputSchema: { type: "object", properties: { userId: { type: "string", description: "User ID or anonymous ID" }, startDate: { type: "string", description: "Start date in ISO format" }, endDate: { type: "string", description: "End date in ISO format" }, includeEvents: { type: "boolean", description: "Include detailed events (default false)" } }, required: ["userId"] } },