get_error_codes
Retrieve all error codes and their descriptions from the RS.ge tax system to identify and resolve waybill processing issues.
Instructions
Get all error codes and their descriptions from RS.ge system
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/get-dictionaries.ts:64-96 (handler)The executeGetErrorCodes function that executes the core logic of the 'get_error_codes' MCP tool: fetches error codes via SOAP client and formats them into a human-readable response limited to first 20 entries.export async function executeGetErrorCodes( client: RsWaybillSoapClient ): Promise<string> { const logger = getLogger(); try { logger.info('Getting error codes'); const codes = await client.getErrorCodes(); if (codes.length === 0) { return 'No error codes found'; } let response = `RS.ge Error Codes (${codes.length}):\n\n`; codes.slice(0, 20).forEach((code: any) => { response += `- ${code.CODE}: ${code.NAME}`; if (code.DESCRIPTION) { response += ` - ${code.DESCRIPTION}`; } response += '\n'; }); if (codes.length > 20) { response += `\n... and ${codes.length - 20} more error codes`; } return response; } catch (error) { logger.error('Error in get_error_codes tool', { error }); return formatErrorForUser(error); } }
- src/tools/get-dictionaries.ts:54-62 (schema)Tool definition including name, description, and input schema (empty object, no parameters required).export const getErrorCodesTool = { name: 'get_error_codes', description: 'Get all error codes and their descriptions from RS.ge system', inputSchema: { type: 'object' as const, properties: {}, required: [], }, };
- src/index.ts:124-127 (registration)Registration of the getErrorCodesTool in the MCP 'listTools' handler, conditionally based on feature flag.if (features.getErrorCodes) { tools.push(getWaybillTypesTool); tools.push(getErrorCodesTool); }
- src/index.ts:170-175 (registration)Dispatcher case in MCP 'callTool' handler that invokes executeGetErrorCodes when 'get_error_codes' is called, with feature flag check.case 'get_error_codes': if (!features.getErrorCodes) { throw new Error('get_error_codes tool is disabled'); } result = await executeGetErrorCodes(soapClient); break;
- src/services/soap-client.ts:315-322 (helper)SOAP client helper method that makes the actual 'get_error_codes' API call to RS.ge and normalizes the response array.async getErrorCodes(): Promise<any[]> { const response = await this.callSoap<GetErrorCodesResponse>('get_error_codes', { su: this.credentials.user, sp: this.credentials.password, }); return normalizeToArray(response.ERROR_CODES?.ERROR_CODE); }