get_events
Retrieve website event data for specified time periods to analyze user interactions and track engagement metrics.
Instructions
Get event data for a website over time
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| websiteId | Yes | Website UUID | |
| startAt | Yes | Start timestamp in milliseconds | |
| endAt | Yes | End timestamp in milliseconds | |
| unit | Yes | Time grouping unit | |
| timezone | No | Timezone (e.g. 'Asia/Seoul') | |
| url | No | Filter by URL path |
Implementation Reference
- src/tools/stats.ts:96-116 (handler)The "get_events" tool is defined and registered within the `registerStatsTools` function in `src/tools/stats.ts`. It takes a website ID, date range, unit, timezone, and optional URL filter as inputs, and fetches data from the `/api/websites/${websiteId}/events` endpoint.
server.tool( "get_events", "Get event data for a website over time", { websiteId: z.string().describe("Website UUID"), ...dateRange, unit: z.enum(["hour", "day", "week", "month", "year"]).describe("Time grouping unit"), timezone: z.string().optional().describe("Timezone (e.g. 'Asia/Seoul')"), url: z.string().optional().describe("Filter by URL path"), }, async ({ websiteId, startAt, endAt, unit, timezone, url }) => { const data = await client.call("GET", `/api/websites/${websiteId}/events`, undefined, { startAt, endAt, unit, timezone, url, }); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );