Skip to main content
Glama

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
NameRequiredDescriptionDefault
idYesThe ID of the invoice to update (required)
client_idNoUpdate the client ID
subjectNoUpdate invoice subject
notesNoUpdate invoice notes
currencyNoUpdate currency code
issue_dateNoUpdate issue date
due_dateNoUpdate due date
payment_termNoUpdate payment terms
taxNoUpdate tax percentage
tax2NoUpdate second tax percentage
discountNoUpdate discount percentage
purchase_orderNoUpdate purchase order number

Implementation Reference

  • 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');
        }
      }
    }
  • 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),
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ianaleck/harvest-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server