Skip to main content
Glama
lekt9

OpenReplay MCP Server

by lekt9

search_sessions

Search and filter user sessions by date, filters, and pagination on the OpenReplay MCP Server. Requires userId and API key authentication for streamlined session analysis.

Instructions

[Requires userId with API key auth] Search and filter sessions. Full search requires JWT authentication.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endDateNoEnd date in ISO format
filtersNoFilters (limited with API key auth)
limitNoNumber of sessions to return
offsetNoOffset for pagination
sortNo
startDateNoStart date in ISO format
userIdNoRequired: User ID to search sessions for

Implementation Reference

  • The core handler function implementing the search_sessions tool logic. It requires a userId and fetches sessions from the OpenReplay API /users/{userId}/sessions endpoint with date range parameters, returning JSON data.
    private async searchSessions(args: any) { // Note: The v1 API with API keys has limited endpoints // For full session search, JWT authentication is required // This uses the user sessions endpoint as an alternative if (!args.userId) { return { content: [ { type: "text", text: "Session search requires a userId when using API key authentication. For full search capabilities, JWT authentication is needed.", }, ], }; } const response = await this.api.get(`/api/v1/${OPENREPLAY_PROJECT_KEY}/users/${args.userId}/sessions`, { params: { start_date: args.startDate ? new Date(args.startDate).getTime() : Date.now() - 7 * 24 * 60 * 60 * 1000, end_date: args.endDate ? new Date(args.endDate).getTime() : Date.now() } }); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; }
  • JSON Schema defining the input parameters for the search_sessions tool, including userId (required in practice), dates, filters array, pagination, and sorting.
    inputSchema: { type: "object", properties: { userId: { type: "string", description: "Required: User ID to search sessions for" }, startDate: { type: "string", description: "Start date in ISO format" }, endDate: { type: "string", description: "End date in ISO format" }, filters: { type: "array", description: "Filters (limited with API key auth)", items: { type: "object", properties: { type: { type: "string", description: "Filter type" }, operator: { type: "string", description: "Operator" }, value: { type: ["string", "number", "array"], description: "Filter value" } } } }, limit: { type: "number", description: "Number of sessions to return" }, offset: { type: "number", description: "Offset for pagination" }, sort: { type: "object", properties: { field: { type: "string", description: "Field to sort by" }, order: { type: "string", enum: ["asc", "desc"], description: "Sort order" } } } }, required: [] }
  • src/index.ts:76-109 (registration)
    Registration of the search_sessions tool in the list of available tools returned by ListToolsRequest, including name, description, and input schema.
    { name: "search_sessions", description: "[Requires userId with API key auth] Search and filter sessions. Full search requires JWT authentication.", inputSchema: { type: "object", properties: { userId: { type: "string", description: "Required: User ID to search sessions for" }, startDate: { type: "string", description: "Start date in ISO format" }, endDate: { type: "string", description: "End date in ISO format" }, filters: { type: "array", description: "Filters (limited with API key auth)", items: { type: "object", properties: { type: { type: "string", description: "Filter type" }, operator: { type: "string", description: "Operator" }, value: { type: ["string", "number", "array"], description: "Filter value" } } } }, limit: { type: "number", description: "Number of sessions to return" }, offset: { type: "number", description: "Offset for pagination" }, sort: { type: "object", properties: { field: { type: "string", description: "Field to sort by" }, order: { type: "string", enum: ["asc", "desc"], description: "Sort order" } } } }, required: [] } },
  • src/index.ts:278-279 (registration)
    Dispatch routing in the CallToolRequest handler switch statement that calls the searchSessions method.
    case "search_sessions": return await this.searchSessions(args);

Other Tools

Related Tools

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