Skip to main content
Glama

delete_invoice

Permanently delete an invoice and all associated billing data. This action 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

  • The DeleteInvoiceHandler class that executes the delete_invoice tool logic. It validates the invoice_id input, calls harvestClient.deleteInvoice(), and returns a success message.
    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');
        }
      }
    }
  • The tool registration entry for 'delete_invoice' that defines its name, description, inputSchema, and handler.
    {
      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),
    },
  • The input schema for the delete_invoice tool - requires a single invoice_id field of type number.
    inputSchema: {
      type: 'object',
      properties: {
        invoice_id: { type: 'number', description: 'The ID of the invoice to delete' },
      },
      required: ['invoice_id'],
      additionalProperties: false,
  • The invoices client method that actually makes the HTTP DELETE request to the Harvest API at /invoices/{invoiceId}.
    async deleteInvoice(invoiceId: number): Promise<void> {
      try {
        this.logger.debug('Deleting invoice', { invoiceId });
        await this.client.delete(`/invoices/${invoiceId}`);
        this.logger.info('Successfully deleted invoice', { invoiceId });
      } catch (error) {
        this.logger.error('Failed to delete invoice', { invoiceId, error: (error as Error).message });
        throw error;
      }
    }
  • The Harvest API wrapper method that delegates deleteInvoice to the invoices client.
    async deleteInvoice(invoiceId: number): Promise<void> {
      return this.invoicesClient.deleteInvoice(invoiceId);
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the behavioral burden. It explicitly states the action is permanent and irreversible, and reveals the scope ('all associated billing data'). This provides strong transparency for a destructive operation, though it lacks details on authentication or error handling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences with zero waste. The first sentence states the primary action, and the second adds critical consequence. It is front-loaded and every word adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple delete operation with one required parameter and no output schema, the description covers the main behavior and side effects. It could be improved by mentioning expected response (e.g., success/failure) but is mostly complete given the tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the parameter 'invoice_id' is fully documented in the schema. The description adds no additional meaning beyond what the schema states, earning a baseline score of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Delete' and the resource 'invoice', and emphasizes permanence and scope ('all associated billing data'). This distinguishes it from sibling delete tools (e.g., delete_client, delete_estimate) by specifically naming the entity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use (when you want to permanently remove an invoice) but provides no explicit guidance on when not to use or alternatives. Siblings exist for other entities, but no comparative context is given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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