harvest_time_report
Generate detailed time reports for specific date ranges, with optional filtering by user, project, or client to track work hours and activities.
Instructions
Generate detailed time reports for date ranges. Use about {"tool": "harvest_time_report"} for filtering options and examples.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| client_id | No | Filter by client ID | |
| from | Yes | Start date (YYYY-MM-DD) | |
| project_id | No | Filter by project ID | |
| to | Yes | End date (YYYY-MM-DD) | |
| user_id | No | Filter by user ID |
Implementation Reference
- src/index.ts:246-255 (handler)MCP tool handler: Dispatches 'harvest_time_report' tool call to HarvestClient.getTimeReport method and formats JSON response.case 'harvest_time_report': const timeReport = await harvestClient.getTimeReport(typedArgs); return { content: [ { type: 'text', text: JSON.stringify(timeReport, null, 2), }, ], };
- src/harvest-client.ts:161-164 (handler)Core implementation: Calls Harvest API /reports/time/team endpoint with query parameters from tool input to generate time report.async getTimeReport(options?: any) { const queryString = this.buildQueryString(options); return this.makeRequest(`/reports/time/team${queryString}`); }
- src/tools.ts:181-194 (schema)Tool schema definition: Specifies name, description, input parameters (date range required, optional filters), and validation.name: 'harvest_time_report', description: 'Generate detailed time reports for date ranges. Use about {"tool": "harvest_time_report"} for filtering options and examples.', inputSchema: { type: 'object', properties: { from: { type: 'string', description: 'Start date (YYYY-MM-DD)' }, to: { type: 'string', description: 'End date (YYYY-MM-DD)' }, user_id: { type: 'string', description: 'Filter by user ID' }, project_id: { type: 'string', description: 'Filter by project ID' }, client_id: { type: 'string', description: 'Filter by client ID' } }, required: ['from', 'to'] } },
- src/index.ts:69-73 (registration)Registers all tools (including harvest_time_report) for MCP listTools request by exporting tools array from tools.ts.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: tools, }; });
- src/harvest-client.ts:59-71 (helper)Helper utility: Converts tool input parameters to query string for Harvest API requests.private buildQueryString(params?: Record<string, any>): string { if (!params) return ''; const queryParams = new URLSearchParams(); Object.entries(params).forEach(([key, value]) => { if (value !== undefined && value !== null) { queryParams.append(key, String(value)); } }); const queryString = queryParams.toString(); return queryString ? `?${queryString}` : ''; }