harvest_list_time_entries
Retrieve time entries from Harvest with filters for user, project, date range, and pagination to track work hours and manage time data.
Instructions
List time entries with optional filters. Use about {"tool": "harvest_list_time_entries"} for detailed usage examples.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | No | Filter by user ID | |
| project_id | No | Filter by project ID | |
| from | No | Start date (YYYY-MM-DD) | |
| to | No | End date (YYYY-MM-DD) | |
| page | No | Page number | |
| per_page | No | Results per page (max 100) |
Implementation Reference
- src/harvest-client.ts:74-77 (handler)Core handler function that builds query parameters from input options and makes an authenticated GET request to the Harvest API /time_entries endpoint to list time entries with optional filters.async getTimeEntries(options?: any) { const queryString = this.buildQueryString(options); return this.makeRequest(`/time_entries${queryString}`); }
- src/tools.ts:5-19 (schema)Tool definition including name, description, and input schema for validation and MCP tool listing.{ name: 'harvest_list_time_entries', description: 'List time entries with optional filters. Use about {"tool": "harvest_list_time_entries"} for detailed usage examples.', inputSchema: { type: 'object', properties: { user_id: { type: 'string', description: 'Filter by user ID' }, project_id: { type: 'string', description: 'Filter by project ID' }, from: { type: 'string', description: 'Start date (YYYY-MM-DD)' }, to: { type: 'string', description: 'End date (YYYY-MM-DD)' }, page: { type: 'number', description: 'Page number' }, per_page: { type: 'number', description: 'Results per page (max 100)' } } } },
- src/index.ts:83-92 (registration)MCP CallToolRequest dispatch case that invokes the handler and formats the response as MCP content.case 'harvest_list_time_entries': const timeEntries = await harvestClient.getTimeEntries(typedArgs); return { content: [ { type: 'text', text: JSON.stringify(timeEntries, null, 2), }, ], };
- src/index.ts:69-73 (registration)Registers the tools list including harvest_list_time_entries schema for MCP ListToolsRequest.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: tools, }; });
- src/harvest-client.ts:59-77 (helper)Helper function to construct URL query string from filter parameters used by getTimeEntries.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}` : ''; } // Time Entries async getTimeEntries(options?: any) { const queryString = this.buildQueryString(options); return this.makeRequest(`/time_entries${queryString}`); }