siigo_delete_invoice
Remove invoices from the Siigo accounting system by specifying the invoice ID. This tool helps maintain accurate financial records by deleting unwanted or incorrect invoice entries.
Instructions
Delete an invoice
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Invoice ID |
Implementation Reference
- src/index.ts:409-419 (registration)Registration of the 'siigo_delete_invoice' tool in the MCP server's tool list, including description and input schema requiring an invoice ID.{ name: 'siigo_delete_invoice', description: 'Delete an invoice', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Invoice ID' }, }, required: ['id'], }, },
- src/index.ts:938-947 (handler)MCP server handler function for siigo_delete_invoice tool. Extracts the invoice ID from arguments and calls SiigoClient.deleteInvoice, then formats the result as MCP content response.private async handleDeleteInvoice(args: any) { const result = await this.siigoClient.deleteInvoice(args.id); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], };
- src/siigo-client.ts:116-118 (handler)Core handler in SiigoClient that performs the actual DELETE HTTP request to the Siigo API endpoint `/v1/invoices/${id}` using the generic makeRequest method.async deleteInvoice(id: string): Promise<SiigoApiResponse<any>> { return this.makeRequest<any>('DELETE', `/v1/invoices/${id}`); }
- src/siigo-client.ts:41-59 (helper)Generic helper method in SiigoClient for making authenticated HTTP requests to Siigo API, used by deleteInvoice and all other endpoints.private async makeRequest<T>(method: string, endpoint: string, data?: any, params?: any): Promise<SiigoApiResponse<T>> { await this.authenticate(); try { const response: AxiosResponse<SiigoApiResponse<T>> = await this.httpClient.request({ method, url: endpoint, data, params, }); return response.data; } catch (error: any) { if (error.response?.data) { return error.response.data; } throw new Error(`API request failed: ${error.message}`); } }
- src/index.ts:91-92 (registration)Switch case in MCP CallToolRequest handler that dispatches 'siigo_delete_invoice' calls to the specific handleDeleteInvoice method.case 'siigo_delete_invoice': return await this.handleDeleteInvoice(args);