Skip to main content
Glama
robobobby
by robobobby

dk_municipality_lookup

Find Danish municipalities by code or name to retrieve official details including region, geographic boundaries, and administrative codes for data verification and location analysis.

Instructions

Look up a Danish municipality (kommune) by code or search by name. Returns name, code, region, and geographic bounds.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNo4-digit municipality code (e.g. '0101' for Copenhagen)
nameNoMunicipality name to search (e.g. 'Solrød')

Implementation Reference

  • The 'dk_municipality_lookup' tool registration and handler implementation. It uses a helper function 'dawaFetch' to query the municipal API and formats the result as markdown.
    // Tool 4: Municipality info
    server.tool(
      "dk_municipality_lookup",
      "Look up a Danish municipality (kommune) by code or search by name. Returns name, code, region, and geographic bounds.",
      {
        code: z.string().optional().describe("4-digit municipality code (e.g. '0101' for Copenhagen)"),
        name: z.string().optional().describe("Municipality name to search (e.g. 'Solrød')"),
      },
      async ({ code, name }) => {
        try {
          let data;
          if (code) {
            data = [await dawaFetch(`/kommuner/${code}`)];
          } else if (name) {
            data = await dawaFetch("/kommuner", { q: name });
          } else {
            return { content: [{ type: "text", text: "Provide either code or name." }], isError: true };
          }
          if (!data.length) return { content: [{ type: "text", text: "No municipality found." }] };
          const lines = data.map(k => {
            const parts = [`## ${k.navn} (${k.kode})`];
            if (k.regionskode) parts.push(`**Region code:** ${k.regionskode}`);
            if (k.bbox) parts.push(`**Bounds:** ${k.bbox[1].toFixed(4)}°N to ${k.bbox[3].toFixed(4)}°N`);
            if (k.href) parts.push(`**API:** ${k.href}`);
            return parts.join("\n");
          });
          return { content: [{ type: "text", text: lines.join("\n\n") }] };
        } catch (err) {
          return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true };
        }
      }
    );

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/robobobby/mcp-nordic'

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