getSummaryReport
Generate summary reports of hours worked by users and projects within specified date ranges, with optional filtering by user IDs or project IDs.
Instructions
Get a summary report of hours by user/project for a date range. Optional: userIds, projectIds.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| start | Yes | Start date (ISO8601) | |
| end | Yes | End date (ISO8601) | |
| userIds | No | Array of user IDs (optional) | |
| projectIds | No | Array of project IDs (optional) |
Implementation Reference
- src/handlers.ts:104-126 (registration)Registration of the 'getSummaryReport' tool in listToolsHandler, including name, description, and input schema definition.{ name: "getSummaryReport", description: "Get a summary report of hours by user/project for a date range. Optional: userIds, projectIds.", inputSchema: { type: "object", properties: { start: { type: "string", description: "Start date (ISO8601)" }, end: { type: "string", description: "End date (ISO8601)" }, userIds: { type: "array", items: { type: "string" }, description: "Array of user IDs (optional)", }, projectIds: { type: "array", items: { type: "string" }, description: "Array of project IDs (optional)", }, }, required: ["start", "end"], }, },
- src/handlers.ts:266-296 (handler)Handler implementation in callToolHandler switch statement. Extracts parameters, validates start/end dates, constructs POST body for Clockify summary reports API, fetches the report, and returns it as JSON text content.case "getSummaryReport": { const { start, end, userIds, projectIds } = request.params.arguments || {}; if (!start || !end) { throw new Error("start and end are required"); } const body = { dateRangeStart: start, dateRangeEnd: end, users: Array.isArray(userIds) ? userIds : undefined, projects: Array.isArray(projectIds) ? projectIds : undefined, summaryFilter: {}, sortOrder: "ASCENDING", groups: ["USER", "PROJECT"], }; const report = await clockifyFetch( `/workspaces/${workspaceId}/reports/summary`, { method: "POST", body: JSON.stringify(body), }, ); return { content: [ { type: "text", text: JSON.stringify(report, null, 2), }, ], }; }