dk_address_search
Search Danish addresses using text queries to find locations with coordinates for autocomplete and validation purposes.
Instructions
Search for Danish addresses by free-text query (street name, full address, postal code + city). Returns matching addresses with coordinates. Great for autocomplete and address validation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Address search text, e.g. 'Nørrebrogade 1, København' or 'Ølsemagle Strand' | |
| limit | No | Max results (default 10) | |
| municipality | No | Filter by municipality code (e.g. '0101' for Copenhagen) | |
| postal_code | No | Filter by postal code (e.g. '2200') |
Implementation Reference
- src/servers/danish-addresses.js:51-61 (handler)The handler function for dk_address_search, which constructs query parameters and fetches data from the DAWA API.
async ({ query, limit, municipality, postal_code }) => { try { const params = { q: query, struktur: "mini", per_side: limit || 10 }; if (municipality) params.kommunekode = municipality; if (postal_code) params.postnr = postal_code; const data = await dawaFetch("/adresser", params); return { content: [{ type: "text", text: formatAddressList(data) }] }; } catch (err) { return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true }; } } - Input schema for dk_address_search, defining query, limit, municipality, and postal_code parameters using zod.
{ query: z.string().describe("Address search text, e.g. 'Nørrebrogade 1, København' or 'Ølsemagle Strand'"), limit: z.number().min(1).max(50).optional().describe("Max results (default 10)"), municipality: z.string().optional().describe("Filter by municipality code (e.g. '0101' for Copenhagen)"), postal_code: z.string().optional().describe("Filter by postal code (e.g. '2200')"), }, - src/servers/danish-addresses.js:42-62 (registration)Registration of the dk_address_search tool using the server.tool method.
server.tool( "dk_address_search", "Search for Danish addresses by free-text query (street name, full address, postal code + city). Returns matching addresses with coordinates. Great for autocomplete and address validation.", { query: z.string().describe("Address search text, e.g. 'Nørrebrogade 1, København' or 'Ølsemagle Strand'"), limit: z.number().min(1).max(50).optional().describe("Max results (default 10)"), municipality: z.string().optional().describe("Filter by municipality code (e.g. '0101' for Copenhagen)"), postal_code: z.string().optional().describe("Filter by postal code (e.g. '2200')"), }, async ({ query, limit, municipality, postal_code }) => { try { const params = { q: query, struktur: "mini", per_side: limit || 10 }; if (municipality) params.kommunekode = municipality; if (postal_code) params.postnr = postal_code; const data = await dawaFetch("/adresser", params); return { content: [{ type: "text", text: formatAddressList(data) }] }; } catch (err) { return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true }; } } );