siigo_get_credit_note
Retrieve a specific credit note by its unique ID from the Siigo accounting system to access transaction details and documentation.
Instructions
Get a specific credit note by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Credit note ID |
Implementation Reference
- src/index.ts:981-984 (handler)MCP server handler function for the 'siigo_get_credit_note' tool. It extracts the ID from arguments, calls SiigoClient.getCreditNote, and formats the result as MCP content response.private async handleGetCreditNote(args: any) { const result = await this.siigoClient.getCreditNote(args.id); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- src/siigo-client.ts:133-135 (handler)Core tool execution logic in SiigoClient: sends authenticated GET request to Siigo API endpoint `/v1/credit-notes/${id}` via makeRequest helper.async getCreditNote(id: string): Promise<SiigoApiResponse<any>> { return this.makeRequest<any>('GET', `/v1/credit-notes/${id}`); }
- src/index.ts:457-467 (registration)Tool registration in the getTools() method, including name, description, and input schema definition.{ name: 'siigo_get_credit_note', description: 'Get a specific credit note by ID', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Credit note ID' }, }, required: ['id'], }, },
- src/index.ts:460-466 (schema)Input schema definition for the tool, specifying required 'id' parameter as string.inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Credit note ID' }, }, required: ['id'], },
- src/siigo-client.ts:41-59 (helper)Helper method used by all API calls, including getCreditNote: handles authentication, makes Axios request, 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}`); } }