siigo_create_voucher
Create accounting vouchers in Siigo software to document financial transactions and maintain accurate records.
Instructions
Create a new voucher
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| voucher | Yes | Voucher data |
Implementation Reference
- src/siigo-client.ts:150-152 (handler)Core handler implementation for siigo_create_voucher tool. Performs authenticated POST request to Siigo API /v1/vouchers endpoint with provided voucher data.async createVoucher(voucher: any): Promise<SiigoApiResponse<any>> { return this.makeRequest<any>('POST', '/v1/vouchers', voucher); }
- src/index.ts:1001-1004 (handler)MCP server handler that receives tool call, extracts voucher args, delegates to SiigoClient.createVoucher, and returns formatted JSON response.private async handleCreateVoucher(args: any) { const result = await this.siigoClient.createVoucher(args.voucher); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- src/index.ts:503-513 (schema)Defines the input schema and metadata for the siigo_create_voucher tool, used in listTools response for client validation.{ name: 'siigo_create_voucher', description: 'Create a new voucher', inputSchema: { type: 'object', properties: { voucher: { type: 'object', description: 'Voucher data' }, }, required: ['voucher'], }, },
- src/index.ts:111-112 (registration)Registers the dispatch case in the switch statement for handling siigo_create_voucher tool calls within the CallToolRequestSchema handler.case 'siigo_create_voucher': return await this.handleCreateVoucher(args);
- src/siigo-client.ts:41-59 (helper)Helper method used by createVoucher to handle authentication, HTTP requests to Siigo API, and error 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}`); } }