aggregate_sessions
Analyze user session data by specifying metrics like count, avg_duration, error_rate, and grouping by hour, day, browser, or country. Use filters and date ranges to extract insights from session analytics.
Instructions
Aggregate session data with various metrics and groupings
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endDate | No | End date in ISO format | |
| filters | No | Same filter format as search_sessions | |
| groupBy | No | Fields to group by | |
| metrics | Yes | Metrics to calculate | |
| startDate | No | Start date in ISO format |
Implementation Reference
- src/index.ts:406-417 (handler)The handler function for the 'aggregate_sessions' tool. It returns a message stating that aggregation is not supported via API key authentication.private async aggregateSessions(args: any) { // Aggregation requires access to the full sessions/search endpoint // which is not available via API key authentication return { content: [ { type: "text", text: "Session aggregation is not available via API key authentication. You can retrieve individual user sessions instead.", }, ], }; }
- src/index.ts:139-167 (registration)Registration of the 'aggregate_sessions' tool in the ListTools response, including name, description, and detailed input schema.{ name: "aggregate_sessions", description: "Aggregate session data with various metrics and groupings", inputSchema: { type: "object", properties: { startDate: { type: "string", description: "Start date in ISO format" }, endDate: { type: "string", description: "End date in ISO format" }, metrics: { type: "array", description: "Metrics to calculate", items: { type: "string", enum: ["count", "avg_duration", "error_rate", "bounce_rate", "unique_users", "page_views"] } }, groupBy: { type: "array", description: "Fields to group by", items: { type: "string", enum: ["hour", "day", "week", "browser", "device", "country", "page", "error_type"] } }, filters: { type: "array", description: "Same filter format as search_sessions" } }, required: ["metrics"] } },
- src/index.ts:142-165 (schema)Input schema definition for the 'aggregate_sessions' tool.inputSchema: { type: "object", properties: { startDate: { type: "string", description: "Start date in ISO format" }, endDate: { type: "string", description: "End date in ISO format" }, metrics: { type: "array", description: "Metrics to calculate", items: { type: "string", enum: ["count", "avg_duration", "error_rate", "bounce_rate", "unique_users", "page_views"] } }, groupBy: { type: "array", description: "Fields to group by", items: { type: "string", enum: ["hour", "day", "week", "browser", "device", "country", "page", "error_type"] } }, filters: { type: "array", description: "Same filter format as search_sessions" } }, required: ["metrics"]
- src/index.ts:284-285 (handler)Dispatch case in the main tool call handler that routes to the aggregateSessions method.case "aggregate_sessions": return await this.aggregateSessions(args);