Skip to main content
Glama

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
NameRequiredDescriptionDefault
countryCodeYesEU member state code / Kód členského štátu EÚ
vatNumberYesTest 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'], }, },
  • 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)' }) }), });
  • 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, }, ], }; }
  • 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; } }
  • 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(), });
  • 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; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Jazib-but/check-vat-vies-mcp-Jazib'

If you have feedback or need assistance with the MCP directory API, please join our Discord server