harvest_stop_timer
Stop a active time entry timer in Harvest by providing the time entry ID, allowing users to end tracking sessions and finalize work duration records.
Instructions
Stop a running time entry timer. Use about {"tool": "harvest_stop_timer"} for detailed workflow and examples.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Time entry ID |
Implementation Reference
- src/index.ts:140-149 (handler)MCP server handler for 'harvest_stop_timer' tool: extracts ID from arguments, calls HarvestClient.stopTimer(id), and returns the result as JSON text content.case 'harvest_stop_timer': const stoppedTimer = await harvestClient.stopTimer(typedArgs.id as string); return { content: [ { type: 'text', text: JSON.stringify(stoppedTimer, null, 2), }, ], };
- src/tools.ts:73-83 (schema)Tool schema definition including name, description, and inputSchema requiring 'id' parameter (string). Part of the exported tools array used for tool listing.{ name: 'harvest_stop_timer', description: 'Stop a running time entry timer. Use about {"tool": "harvest_stop_timer"} for detailed workflow and examples.', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Time entry ID' } }, required: ['id'] } },
- src/harvest-client.ts:110-114 (helper)Core helper method in HarvestClient that performs PATCH request to Harvest API endpoint /time_entries/{id}/stop to stop the running timer.async stopTimer(id: string) { return this.makeRequest(`/time_entries/${id}/stop`, { method: 'PATCH', }); }
- src/harvest-client.ts:27-57 (helper)Generic HTTP request helper used by stopTimer: constructs authenticated fetch request to Harvest API with error handling.private async makeRequest(endpoint: string, options: RequestInit = {}) { const url = `${this.baseUrl}${endpoint}`; const response = await fetch(url, { ...options, headers: { 'Authorization': `Bearer ${this.accessToken}`, 'Harvest-Account-ID': this.accountId, 'User-Agent': this.userAgent, 'Content-Type': 'application/json', ...options.headers, }, }); if (!response.ok) { let errorMessage = `Harvest API error: ${response.status} ${response.statusText}`; try { const errorBody = await response.json() as any; if (errorBody.message) { errorMessage += ` - ${errorBody.message}`; } } catch { // If we can't parse the error response, use the basic error message } throw new Error(errorMessage); } return response.json(); }