delete_estimate
Permanently delete an estimate from Harvest. This action cannot be undone.
Instructions
Delete an estimate permanently. This action cannot be undone.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| estimate_id | Yes | The ID of the estimate to delete |
Implementation Reference
- src/tools/estimates.ts:94-112 (handler)The DeleteEstimateHandler class implements the tool logic. It validates input via zod schema (estimate_id), calls harvestClient.deleteEstimate(), and returns a success message or delegates to handleMCPToolError.
class DeleteEstimateHandler implements ToolHandler { constructor(private readonly config: BaseToolConfig) {} async execute(args: Record<string, any>): Promise<CallToolResult> { try { const inputSchema = z.object({ estimate_id: z.number().int().positive() }); const { estimate_id } = validateInput(inputSchema, args, 'delete estimate'); logger.info('Deleting estimate via Harvest API', { estimateId: estimate_id }); await this.config.harvestClient.deleteEstimate(estimate_id); return { content: [{ type: 'text', text: JSON.stringify({ message: `Estimate ${estimate_id} deleted successfully` }, null, 2) }], }; } catch (error) { return handleMCPToolError(error, 'delete_estimate'); } } } - src/tools/estimates.ts:99-99 (schema)Inline zod schema for delete_estimate input validation: requires an estimate_id (positive integer).
const inputSchema = z.object({ estimate_id: z.number().int().positive() }); - src/tools/estimates.ts:198-212 (registration)Registration entry in registerEstimateTools(): defines tool name 'delete_estimate', description, inputSchema (object with estimate_id number), and maps to DeleteEstimateHandler.
{ tool: { name: 'delete_estimate', description: 'Delete an estimate permanently. This action cannot be undone.', inputSchema: { type: 'object', properties: { estimate_id: { type: 'number', description: 'The ID of the estimate to delete' }, }, required: ['estimate_id'], additionalProperties: false, }, }, handler: new DeleteEstimateHandler(config), }, - EstimatesClient.deleteEstimate() — the HTTP client helper that sends DELETE /estimates/{estimateId} to the Harvest API.
async deleteEstimate(estimateId: number): Promise<void> { try { this.logger.debug('Deleting estimate', { estimateId }); await this.client.delete(`/estimates/${estimateId}`); this.logger.info('Successfully deleted estimate', { estimateId }); } catch (error) { this.logger.error('Failed to delete estimate', { estimateId, error: (error as Error).message }); throw error; } } - src/client/harvest-api.ts:301-303 (helper)HarvestApi.deleteEstimate() — delegates to estimatesClient.deleteEstimate().
async deleteEstimate(estimateId: number): Promise<void> { return this.estimatesClient.deleteEstimate(estimateId); } - src/server.ts:140-140 (registration)Server category mapping includes 'delete_estimate' in the 'estimates' category group.
'estimates': ['list_estimates', 'get_estimate', 'create_estimate', 'update_estimate', 'delete_estimate'],