siigo_get_purchase
Retrieve a specific purchase record from Siigo accounting software using its unique ID to access transaction details and documentation.
Instructions
Get a specific purchase by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Purchase ID |
Implementation Reference
- src/index.ts:527-537 (registration)Tool registration in getTools() array, including name, description, and input schema definition.{ name: 'siigo_get_purchase', description: 'Get a specific purchase by ID', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Purchase ID' }, }, required: ['id'], }, },
- src/index.ts:1011-1014 (handler)MCP server handler method for 'siigo_get_purchase' tool, delegates to SiigoClient.getPurchase and formats response.private async handleGetPurchase(args: any) { const result = await this.siigoClient.getPurchase(args.id); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- src/siigo-client.ts:159-161 (handler)SiigoClient.getPurchase method: the core implementation that makes the authenticated GET request to Siigo API /v1/purchases/{id}.async getPurchase(id: string): Promise<SiigoApiResponse<any>> { return this.makeRequest<any>('GET', `/v1/purchases/${id}`); }
- src/siigo-client.ts:41-59 (helper)makeRequest helper: handles authentication, makes Axios request 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}`); } }
- src/index.ts:117-118 (registration)Switch case registration/dispatch for the tool name to handler in CallToolRequestSchema handler.case 'siigo_get_purchase': return await this.handleGetPurchase(args);