Skip to main content
Glama

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
NameRequiredDescriptionDefault
invoice_idYesThe ID of the invoice to delete

Implementation Reference

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

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