check_vat_test_service
Test VIES service integration using predefined VAT numbers to verify system connectivity and validate EU VAT number checking functionality.
Instructions
Test VIES service integration with test VAT numbers / Testovať integráciu so službou VIES
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| countryCode | Yes | EU member state code / Kód členského štátu EÚ | |
| vatNumber | Yes | Test VAT number: 100 (valid), 200 (invalid) / Testové IČ DPH: 100 (platné), 200 (neplatné) |
Implementation Reference
- src/index.ts:56-75 (registration)Registration of the 'check_vat_test_service' tool in the ListTools response, including name, description, and inline input schema.{ name: 'check_vat_test_service', description: 'Test VIES service integration with test VAT numbers / Testovať integráciu so službou VIES', inputSchema: { type: 'object', properties: { countryCode: { type: 'string', enum: [...EU_MEMBER_STATES], description: 'EU member state code / Kód členského štátu EÚ', }, vatNumber: { type: 'string', enum: ['100', '200'], description: 'Test VAT number: 100 (valid), 200 (invalid) / Testové IČ DPH: 100 (platné), 200 (neplatné)', }, }, required: ['countryCode', 'vatNumber'], }, },
- src/schemas.ts:18-23 (schema)Zod input schema used for parsing tool arguments: requires countryCode from EU states and vatNumber as '100' (valid) or '200' (invalid).export const checkVatTestSchema = z.object({ countryCode: z.enum(EU_MEMBER_STATES), vatNumber: z.enum(['100', '200'], { errorMap: () => ({ message: 'Test VAT number must be 100 (valid) or 200 (invalid)' }) }), });
- src/index.ts:118-132 (handler)MCP tool execution handler: parses input with checkVatTestSchema, delegates to ViesApiClient, formats response as text using test mode.case 'check_vat_test_service': { const params = checkVatTestSchema.parse(args); const result = await this.viesClient.checkVatTestService(params); const responseText = this.formatVatValidationResult(result, true); return { content: [ { type: 'text', text: responseText, }, ], }; }
- src/client.ts:91-120 (handler)Core implementation in ViesApiClient: HTTP POST to VIES '/check-vat-test-service', parses response, returns VatNumberInfo (no preprocessing for test).async checkVatTestService(params: CheckVatTestParams): Promise<VatNumberInfo> { try { const response = await this.client.post('/check-vat-test-service', { countryCode: params.countryCode, vatNumber: params.vatNumber, }); const validatedData = vatValidationResponseSchema.parse(response.data); return { countryCode: validatedData.countryCode || params.countryCode, vatNumber: validatedData.vatNumber || params.vatNumber, isValid: validatedData.valid, companyName: validatedData.name, companyAddress: validatedData.address, requestDate: validatedData.requestDate, wasPreprocessed: false, // Test service doesn't preprocess }; } catch (error) { if (error instanceof ViesApiError) { try { const errorData = errorResponseSchema.parse(error.response); throw new Error(`VIES test service failed: ${errorData.error}${errorData.message ? ` - ${errorData.message}` : ''}`); } catch { throw error; } } throw error; } }
- src/schemas.ts:26-37 (schema)Zod schema for parsing VIES VAT validation response (used by both checkVatNumber and checkVatTestService).export const vatValidationResponseSchema = z.object({ valid: z.boolean(), requestDate: z.string(), userError: z.string().optional(), name: z.string().optional(), address: z.string().optional(), requestIdentifier: z.string().optional(), originalVatNumber: z.string().optional(), vatNumber: z.string().optional(), originalCountryCode: z.string().optional(), countryCode: z.string().optional(), });
- src/index.ts:211-240 (helper)Helper function to format VatNumberInfo result into bilingual text response, with test mode prefix.private formatVatValidationResult(result: any, isTest = false): string { const testPrefix = isTest ? '[TEST] ' : ''; const header = isTest ? `${testPrefix}VAT Test Service Result / Výsledok testovej služby IČ DPH:` : `${testPrefix}VAT Validation Result / Výsledok validácie IČ DPH:`; let response = `${header}\n\n`; response += `Country Code / Kód krajiny: ${result.countryCode}\n`; response += `VAT Number / IČ DPH: ${result.vatNumber}\n`; response += `Valid / Platné: ${result.isValid ? 'YES / ÁNO' : 'NO / NIE'}\n`; response += `Request Date / Dátum požiadavky: ${result.requestDate}\n`; if (result.companyName) { response += `Company Name / Názov spoločnosti: ${result.companyName}\n`; } if (result.companyAddress) { response += `Company Address / Adresa spoločnosti: ${result.companyAddress}\n`; } if (result.wasPreprocessed && result.originalVatNumber) { response += `\nNote / Poznámka: VAT number was preprocessed / IČ DPH bolo predspracované\n`; response += `Original VAT Number / Pôvodné IČ DPH: ${result.originalVatNumber}\n`; if (result.originalCountryCode) { response += `Original Country Code / Pôvodný kód krajiny: ${result.originalCountryCode}\n`; } } return response; }