Skip to main content
Glama
robobobby
by robobobby

no_address_search

Search Norwegian addresses using text queries, with filters for postal codes and municipalities. Find locations by street names, full addresses, or postal codes.

Instructions

Search for Norwegian addresses by text query. Supports street names, full addresses, postal codes, and municipality filtering.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesAddress search query (e.g. 'Karl Johans gate 1', 'Storgata Oslo', 'Bryggen Bergen')
postal_codeNoFilter by postal code (4 digits, e.g. '0154')
municipalityNoFilter by municipality name (e.g. 'OSLO', 'BERGEN', 'TRONDHEIM')
limitNoMax results (default 10, max 50)
fuzzyNoEnable fuzzy matching for misspellings (default false)

Implementation Reference

  • The 'no_address_search' tool is registered and its handler is defined here using the Kartverket Adresser API to search for Norwegian addresses based on a query and optional filters.
    server.tool(
      "no_address_search",
      "Search for Norwegian addresses by text query. Supports street names, full addresses, postal codes, and municipality filtering.",
      {
        query: z.string().describe("Address search query (e.g. 'Karl Johans gate 1', 'Storgata Oslo', 'Bryggen Bergen')"),
        postal_code: z.string().optional().describe("Filter by postal code (4 digits, e.g. '0154')"),
        municipality: z.string().optional().describe("Filter by municipality name (e.g. 'OSLO', 'BERGEN', 'TRONDHEIM')"),
        limit: z.number().min(1).max(50).optional().describe("Max results (default 10, max 50)"),
        fuzzy: z.boolean().optional().describe("Enable fuzzy matching for misspellings (default false)"),
      },
      async ({ query, postal_code, municipality, limit, fuzzy }) => {
        try {
          const params = {
            sok: query,
            treffPerSide: limit || 10,
          };
          if (postal_code) params.postnummer = postal_code;
          if (municipality) params.kommunenavn = municipality;
          if (fuzzy) params.fuzzy = "true";
    
          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 "${query}".` }] };
          }
    
          const lines = [`## Address Search: "${query}" (${total} total results)\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 };
        }
      }
    );

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