Skip to main content
Glama

no_search_places

Find public transport stops, addresses, and points of interest in Norway using autocomplete search via the Entur Geocoder API.

Instructions

Autocomplete search across stops/addresses/POIs in Norway via Entur Geocoder.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes
langNoen
sizeNo

Implementation Reference

  • The main handler function for the 'no_search_places' tool. It performs an autocomplete search for places in Norway using the Entur Geocoder API via GET request, includes input validation, logging, retry logic for errors/timeouts, and returns the raw JSON response.
    async def no_search_places(text: str, lang: str | None = "en", size: int | None = 10) -> dict[str, object]: """ Args: text: Free-text query (e.g., 'Oslo S', 'Bergen busstasjon'). lang: Language hint ('en', 'no', 'nb', 'nn', etc.). Default: 'en'. size: Max number of results. Default: 10. Returns: Raw Entur Geocoder /autocomplete JSON. """ if not text or not text.strip(): raise ValueError("Parameter 'text' must not be empty.") params = {"text": text.strip(), "lang": (lang or "en"), "size": int(size or 10)} logger.info("🇳🇴 Entur geocoder autocomplete: %r", params) # We'll do our own GET with retry/backoff, independent from any project helper. tries = 3 for attempt in range(1, tries + 1): try: async with aiohttp.ClientSession(timeout=_make_timeout()) as session: async with session.get( NO_GEOCODER_AUTOCOMPLETE_URL, params=params, headers={"ET-Client-Name": NO_CLIENT_NAME, "Accept": "application/json"}, timeout=_make_timeout(), ) as resp: if resp.status == 429 or resp.status >= 500: if attempt < tries: await asyncio.sleep(0.5 * (2 ** (attempt - 1))) continue text_body = await resp.text() raise TransportAPIError(f"Entur Geocoder HTTP {resp.status}: {text_body}") if resp.status >= 400: text_body = await resp.text() raise TransportAPIError(f"Entur Geocoder HTTP {resp.status}: {text_body}") return await resp.json() except (asyncio.TimeoutError, aiohttp.ServerTimeoutError) as e: if attempt < tries: await asyncio.sleep(0.5 * (2 ** (attempt - 1))) continue raise TransportAPIError(f"Entur Geocoder timeout after {tries} attempt(s): {e}") from e raise TransportAPIError("Entur Geocoder: exhausted retries without response")
  • tools/no.py:127-130 (registration)
    The @mcp.tool decorator that registers the 'no_search_places' tool with the MCP server, specifying its name and description.
    @mcp.tool( name="no_search_places", description="Autocomplete search across stops/addresses/POIs in Norway via Entur Geocoder." )
  • tools/no.py:316-316 (registration)
    The register_no_tools function returns a list of registered tool names, including 'no_search_places'.
    return ["no_search_places", "no_stop_departures", "no_trip", "no_nearest_stops"]

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/mirodn/mcp-server-public-transport'

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