delete_invoice
Remove an invoice permanently from Harvest time tracking system. This action deletes all associated billing data and cannot be undone.
Instructions
Delete an invoice permanently. This action cannot be undone and will remove all associated billing data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| invoice_id | Yes | The ID of the invoice to delete |
Implementation Reference
- src/tools/invoices.ts:94-112 (handler)Implementation of the DeleteInvoiceHandler class which executes the deletion logic.
class DeleteInvoiceHandler implements ToolHandler { constructor(private readonly config: BaseToolConfig) {} async execute(args: Record<string, any>): Promise<CallToolResult> { try { const inputSchema = z.object({ invoice_id: z.number().int().positive() }); const { invoice_id } = validateInput(inputSchema, args, 'delete invoice'); logger.info('Deleting invoice via Harvest API', { invoiceId: invoice_id }); await this.config.harvestClient.deleteInvoice(invoice_id); return { content: [{ type: 'text', text: JSON.stringify({ message: `Invoice ${invoice_id} deleted successfully` }, null, 2) }], }; } catch (error) { return handleMCPToolError(error, 'delete_invoice'); } } } - src/tools/invoices.ts:203-217 (registration)Registration of the delete_invoice tool within the registerInvoiceTools function.
{ tool: { name: 'delete_invoice', description: 'Delete an invoice permanently. This action cannot be undone and will remove all associated billing data.', inputSchema: { type: 'object', properties: { invoice_id: { type: 'number', description: 'The ID of the invoice to delete' }, }, required: ['invoice_id'], additionalProperties: false, }, }, handler: new DeleteInvoiceHandler(config), },