get_user_journey
Retrieve a user's complete journey across multiple sessions to analyze behavior patterns and interactions over time.
Instructions
Get the complete journey of a user across multiple sessions
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes | User ID or anonymous ID | |
| startDate | No | Start date in ISO format | |
| endDate | No | End date in ISO format | |
| includeEvents | No | Include detailed events (default false) |
Implementation Reference
- src/index.ts:419-437 (handler)The handler function for get_user_journey tool. It fetches the user's sessions from the OpenReplay API using the v1 endpoint for users/{userId}/sessions, with optional date range parameters, 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)Input schema defining parameters for the get_user_journey tool: required userId (string), optional startDate/endDate (ISO strings), includeEvents (boolean).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:168-181 (registration)Registration of the get_user_journey tool in the ListTools response, including name, description, and input schema.{ 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"] } },
- src/index.ts:286-287 (registration)Registration/dispatch of the get_user_journey tool in the CallToolRequestHandler switch statement.case "get_user_journey": return await this.getUserJourney(args);