Skip to main content
Glama

siigo_create_invoice

Generate invoices in Siigo accounting software by providing customer details, items, payment methods, and required document information.

Instructions

Create a new invoice

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoiceYesInvoice data

Implementation Reference

  • Core implementation of the siigo_create_invoice tool: sends a POST request to the Siigo API endpoint /v1/invoices with the provided invoice data.
    async createInvoice(invoice: SiigoInvoice): Promise<SiigoApiResponse<SiigoInvoice>> { return this.makeRequest<SiigoInvoice>('POST', '/v1/invoices', invoice); }
  • MCP server handler for siigo_create_invoice: extracts args.invoice, calls SiigoClient.createInvoice, and returns JSON-formatted result.
    private async handleCreateInvoice(args: any) { const result = await this.siigoClient.createInvoice(args.invoice); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], };
  • src/index.ts:374-396 (registration)
    Tool registration in getTools(): defines name, description, and inputSchema for siigo_create_invoice.
    { name: 'siigo_create_invoice', description: 'Create a new invoice', inputSchema: { type: 'object', properties: { invoice: { type: 'object', description: 'Invoice data', properties: { document: { type: 'object', properties: { id: { type: 'number' } }, required: ['id'] }, date: { type: 'string', description: 'Invoice date (YYYY-MM-DD)' }, customer: { type: 'object', description: 'Customer information' }, seller: { type: 'number', description: 'Seller ID' }, items: { type: 'array', items: { type: 'object' }, description: 'Invoice items' }, payments: { type: 'array', items: { type: 'object' }, description: 'Payment methods' }, }, required: ['document', 'date', 'customer', 'seller', 'items', 'payments'], }, }, required: ['invoice'], }, },
  • TypeScript interface defining the structure of SiigoInvoice used by the createInvoice method.
    export interface SiigoInvoice { id?: string; document: { id: number; number?: number; }; date: string; customer: { person_type?: string; id_type?: string; identification: string; branch_office?: number; name?: string[]; address?: any; phones?: any[]; contacts?: any[]; }; cost_center?: number; currency?: { code: string; exchange_rate: number; }; seller: number; observations?: string; items: Array<{ code: string; description?: string; quantity: number; price: number; discount?: number; taxes?: Array<{ id: number }>; }>; payments: Array<{ id: number; value: number; due_date?: string; }>; stamp?: { send: boolean; }; mail?: { send: boolean; }; global_discounts?: Array<{ id: number; percentage?: number; value?: number; }>; additional_fields?: any; }
  • Helper method used by createInvoice to handle authentication, make the Axios HTTP request, and process the response or error.
    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}`); } }

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/jdlar1/siigo-mcp'

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