siigo_create_purchase
Create new purchase records in Siigo accounting software to manage procurement transactions and maintain accurate financial records.
Instructions
Create a new purchase
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| purchase | Yes | Purchase data |
Implementation Reference
- src/index.ts:1016-1019 (handler)MCP tool handler for siigo_create_purchase. Extracts purchase data from args and delegates to SiigoClient.createPurchase, then formats and returns the result as text content.private async handleCreatePurchase(args: any) { const result = await this.siigoClient.createPurchase(args.purchase); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- src/index.ts:538-548 (schema)Tool schema definition including name, description, and input schema for creating a purchase.{ name: 'siigo_create_purchase', description: 'Create a new purchase', inputSchema: { type: 'object', properties: { purchase: { type: 'object', description: 'Purchase data' }, }, required: ['purchase'], }, },
- src/index.ts:120-121 (registration)Registration of the tool handler in the switch statement within CallToolRequestSchema handler.return await this.handleCreatePurchase(args); case 'siigo_update_purchase':
- src/siigo-client.ts:163-165 (helper)SiigoClient method that performs the actual API call to create a purchase by POSTing to /v1/purchases.async createPurchase(purchase: any): Promise<SiigoApiResponse<any>> { return this.makeRequest<any>('POST', '/v1/purchases', purchase); }
- src/siigo-client.ts:41-59 (helper)Core helper method in SiigoClient that handles authentication, makes HTTP requests to Siigo API, 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}`); } }