siigo_get_invoice_pdf
Retrieve PDF invoices from Siigo accounting software by providing the invoice ID to access and download financial documents.
Instructions
Get invoice PDF
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Invoice ID |
Implementation Reference
- src/siigo-client.ts:120-122 (handler)Core handler function that performs the authenticated GET request to Siigo API to fetch the invoice PDF as base64.async getInvoicePdf(id: string): Promise<SiigoApiResponse<{ base64: string }>> { return this.makeRequest<{ base64: string }>('GET', `/v1/invoices/${id}/pdf`); }
- src/index.ts:950-959 (handler)MCP server wrapper handler that calls SiigoClient.getInvoicePdf and formats the response for MCP.private async handleGetInvoicePdf(args: any) { const result = await this.siigoClient.getInvoicePdf(args.id); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], };
- src/index.ts:420-430 (registration)Tool registration in MCP server's getTools() method, including name, description, and input schema.{ name: 'siigo_get_invoice_pdf', description: 'Get invoice PDF', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Invoice ID' }, }, required: ['id'], }, },
- src/index.ts:93-94 (handler)Dispatcher switch case that routes the tool call to the specific handler.case 'siigo_get_invoice_pdf': return await this.handleGetInvoicePdf(args);
- src/siigo-client.ts:41-59 (helper)Helper method used by all API calls, including authentication and axios request handling.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}`); } }