update_invoice
Modify existing invoice details like subject, dates, taxes, and billing information in Harvest. Only specified fields are updated to maintain current data integrity.
Instructions
Update an existing invoice including subject, dates, terms, taxes, and other billing details. Only provided fields will be updated.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The ID of the invoice to update (required) | |
| client_id | No | Update the client ID | |
| subject | No | Update invoice subject | |
| notes | No | Update invoice notes | |
| currency | No | Update currency code | |
| issue_date | No | Update issue date | |
| due_date | No | Update due date | |
| payment_term | No | Update payment terms | |
| tax | No | Update tax percentage | |
| tax2 | No | Update second tax percentage | |
| discount | No | Update discount percentage | |
| purchase_order | No | Update purchase order number |
Implementation Reference
- src/tools/invoices.ts:76-92 (handler)The handler class UpdateInvoiceHandler implements the logic for executing the update_invoice tool, validating input against UpdateInvoiceSchema and calling the Harvest API.
class UpdateInvoiceHandler implements ToolHandler { constructor(private readonly config: BaseToolConfig) {} async execute(args: Record<string, any>): Promise<CallToolResult> { try { const validatedArgs = validateInput(UpdateInvoiceSchema, args, 'update invoice'); logger.info('Updating invoice via Harvest API', { invoiceId: validatedArgs.id }); const invoice = await this.config.harvestClient.updateInvoice(validatedArgs); return { content: [{ type: 'text', text: JSON.stringify(invoice, null, 2) }], }; } catch (error) { return handleMCPToolError(error, 'update_invoice'); } } } - src/tools/invoices.ts:177-202 (registration)The tool definition and registration for 'update_invoice' within the registerInvoiceTools function.
{ tool: { name: 'update_invoice', description: 'Update an existing invoice including subject, dates, terms, taxes, and other billing details. Only provided fields will be updated.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'The ID of the invoice to update (required)' }, client_id: { type: 'number', description: 'Update the client ID' }, subject: { type: 'string', description: 'Update invoice subject' }, notes: { type: 'string', description: 'Update invoice notes' }, currency: { type: 'string', minLength: 3, maxLength: 3, description: 'Update currency code' }, issue_date: { type: 'string', format: 'date', description: 'Update issue date' }, due_date: { type: 'string', format: 'date', description: 'Update due date' }, payment_term: { type: 'string', description: 'Update payment terms' }, tax: { type: 'number', minimum: 0, maximum: 100, description: 'Update tax percentage' }, tax2: { type: 'number', minimum: 0, maximum: 100, description: 'Update second tax percentage' }, discount: { type: 'number', minimum: 0, maximum: 100, description: 'Update discount percentage' }, purchase_order: { type: 'string', description: 'Update purchase order number' }, }, required: ['id'], additionalProperties: false, }, }, handler: new UpdateInvoiceHandler(config), },