siigo_get_invoice_pdf
Retrieve PDF documents for Siigo invoices by providing the invoice ID, enabling quick access to digital invoice copies for accounting and record-keeping purposes.
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 implementing the tool logic: makes authenticated GET request to Siigo API endpoint `/v1/invoices/${id}/pdf` to retrieve the invoice PDF.async getInvoicePdf(id: string): Promise<SiigoApiResponse<{ base64: string }>> { return this.makeRequest<{ base64: string }>('GET', `/v1/invoices/${id}/pdf`); }
- src/index.ts:950-960 (handler)MCP server handler for the tool: extracts invoice ID from arguments and delegates to SiigoClient.getInvoicePdf, then formats response as text.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: defines name, description, and input schema (requires 'id' string).{ 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)Switch case dispatching tool calls named 'siigo_get_invoice_pdf' 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: handles authentication, makes HTTP request with axios, and processes responses/errors.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}`); } }