get_error_codes
Retrieve error codes and 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-95 (handler)Main handler function that executes the tool: fetches error codes via SOAP client, formats top 20 into markdown list, handles empty results and errors.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 (registration)MCP tool definition/registration: specifies name, description, and empty input schema (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)Server registration: conditionally adds getErrorCodesTool to the list of available tools returned by listTools().if (features.getErrorCodes) { tools.push(getWaybillTypesTool); tools.push(getErrorCodesTool); }
- src/index.ts:170-175 (registration)Tool dispatch in callTool handler: routes 'get_error_codes' calls to executeGetErrorCodes if feature enabled.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)Supporting SOAP client method: calls RS.ge 'get_error_codes' endpoint, authenticates, parses/normalizes response into 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); }
- src/config/config.schema.ts:58-58 (schema)Feature flag schema for enabling/disabling the get_error_codes tool.getErrorCodes: z.boolean().default(true),