validate_kvk_nl
Verify Dutch KVK business registration numbers using official checksum validation. Ensures correct format for supplier onboarding and invoice processing.
Instructions
Validates a Dutch KVK (Kamer van Koophandel) chamber of commerce number — an 8-digit registration number assigned to all businesses registered in the Netherlands. Verifies the format and applies the official weighted checksum algorithm. Returns { valid: boolean, kvk: string, country: 'NL' } or { valid: false, reason: string }. Use when processing Dutch invoices, validating Dutch suppliers, or onboarding Dutch business partners.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kvk | Yes | 8-digit Dutch KVK number, with or without spaces. Example: '12345678' |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| valid | Yes | ||
| kvk | No | ||
| country | No | ||
| reason | No |
Implementation Reference
- index.js:367-371 (registration)Registration of the validate_kvk_nl tool with the MCP server. Defines metadata: description, input schema (kvk: string), output schema (valid, kvk, country, reason), and annotations.
server.registerTool("validate_kvk_nl", { description: "Validates a Dutch KVK (Kamer van Koophandel) chamber of commerce number — an 8-digit registration number assigned to all businesses registered in the Netherlands. Verifies the format and applies the official weighted checksum algorithm. Returns { valid: boolean, kvk: string, country: 'NL' } or { valid: false, reason: string }. Use when processing Dutch invoices, validating Dutch suppliers, or onboarding Dutch business partners.", inputSchema: { kvk: z.string().describe("8-digit Dutch KVK number, with or without spaces. Example: '12345678'") }, outputSchema: { valid: z.boolean(), kvk: z.string().optional(), country: z.string().optional(), reason: z.string().optional() }, annotations: { title: "Validate Dutch KVK Number", readOnlyHint: true, idempotentHint: true, openWorldHint: false } - index.js:372-380 (handler)Handler function for validate_kvk_nl. Cleans input, validates 8-digit format, applies weighted checksum (weights [8,7,6,5,4,3,2,1]) and returns whether sum % 11 === 0.
}, async ({ kvk }) => { const clean = kvk.replace(/\s/g, ""); if (!/^\d{8}$/.test(clean)) return { content: [{ type: "text", text: JSON.stringify({ valid: false, reason: "KVK number must have exactly 8 digits" }) }] }; const weights = [8, 7, 6, 5, 4, 3, 2, 1]; let sum = 0; for (let i = 0; i < 8; i++) sum += parseInt(clean[i]) * weights[i]; const valid = sum % 11 === 0; return { content: [{ type: "text", text: JSON.stringify({ valid, kvk: clean, country: "NL" }) }] }; });