getSummaryReport
Generate a summary report of hours worked by users or projects within a specified date range. Optionally filter by specific user IDs or project IDs for detailed insights.
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 |
|---|---|---|---|
| end | Yes | End date (ISO8601) | |
| projectIds | No | Array of project IDs (optional) | |
| start | Yes | Start date (ISO8601) | |
| userIds | No | Array of user IDs (optional) |
Implementation Reference
- src/handlers.ts:266-296 (handler)Main execution logic for the getSummaryReport tool within the callToolHandler switch statement. Constructs a POST request to Clockify's summary reports endpoint using provided date range and optional user/project filters, then returns the formatted JSON response.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), }, ], }; }
- src/handlers.ts:108-125 (schema)Input schema definition for the getSummaryReport tool, specifying required start/end dates and optional arrays of 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:104-127 (registration)Registration of the getSummaryReport tool in the listToolsHandler function, including name, description, and input schema.{ 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/index.ts:43-43 (registration)Registers the listToolsHandler on the MCP server, which exposes the getSummaryReport tool among others.server.setRequestHandler(ListToolsRequestSchema, listToolsHandler);
- src/index.ts:49-49 (registration)Registers the callToolHandler on the MCP server, which handles execution of getSummaryReport and other tools.server.setRequestHandler(CallToolRequestSchema, callToolHandler);