Skip to main content
Glama
robobobby
by robobobby

no_postal_code_lookup

Find addresses in Norwegian postal code areas. Use this tool to explore locations within specific postal districts by entering a 4-digit postal code.

Instructions

List addresses in a Norwegian postal code area. Useful for exploring what's in a given postal district.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
postal_codeYesNorwegian postal code (4 digits, e.g. '0154', '5003', '7010')
streetNoOptional street name filter within the postal code area
limitNoMax results (default 10)

Implementation Reference

  • The handler function that executes the logic for the "no_postal_code_lookup" tool, calling the address API.
    async ({ postal_code, street, limit }) => {
      try {
        const params = {
          postnummer: postal_code,
          treffPerSide: limit || 10,
        };
        if (street) params.adressenavn = street;
    
        const data = await apiFetch("/sok", params);
        const total = data.metadata?.totaltAntallTreff || 0;
    
        if (!data.adresser?.length) {
          return { content: [{ type: "text", text: `No addresses found for postal code ${postal_code}.` }] };
        }
    
        const poststed = data.adresser[0]?.poststed || "";
        const lines = [`## Postal Code ${postal_code} ${poststed} (${total} addresses total)\n`];
        for (const a of data.adresser) {
          lines.push(formatAddress(a));
          lines.push("");
        }
        lines.push(`*Kartverket Adresser API — showing ${data.adresser.length} of ${total}*`);
        return { content: [{ type: "text", text: lines.join("\n") }] };
      } catch (err) {
        return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true };
      }
    }
  • The registration of the "no_postal_code_lookup" tool, including its schema/parameter definitions.
    server.tool(
      "no_postal_code_lookup",
      "List addresses in a Norwegian postal code area. Useful for exploring what's in a given postal district.",
      {
        postal_code: z.string().describe("Norwegian postal code (4 digits, e.g. '0154', '5003', '7010')"),
        street: z.string().optional().describe("Optional street name filter within the postal code area"),
        limit: z.number().min(1).max(50).optional().describe("Max results (default 10)"),
      },

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