no_nearest_stops
Find public transport stops near specific coordinates within a defined radius. Input latitude and longitude to locate nearby StopPlaces for trip planning.
Instructions
Find nearest StopPlaces for a coordinate (lat, lon) within a radius in meters.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lat | Yes | ||
| lon | Yes | ||
| radius | No | ||
| limit | No |
Implementation Reference
- tools/no.py:274-314 (handler)The main execution logic for the no_nearest_stops tool. Queries Entur GraphQL API for nearest StopPlaces given latitude, longitude, radius, and limit.async def no_nearest_stops(lat: float, lon: float, radius: int | None = 500, limit: int | None = 10) -> dict[str, object]: """ Args: lat: Latitude. lon: Longitude. radius: Max distance in meters. Default: 500. limit: Max number of places to return. Default: 10. Returns: GraphQL `data` with nearest StopPlaces (distance + names + IDs). """ query = """ query Nearest($lat: Float!, $lon: Float!, $radius: Int!, $first: Int!) { nearest( latitude: $lat, longitude: $lon, maximumDistance: $radius, filterByPlaceTypes: [stopPlace], first: $first ) { edges { node { distance place { ... on StopPlace { id name } } } } } } """ variables = { "lat": float(lat), "lon": float(lon), "radius": int(radius or 500), "first": int(limit or 10), } logger.info( "Entur nearest stops: lat=%s lon=%s radius=%s first=%s", variables["lat"], variables["lon"], variables["radius"], variables["first"] ) return await _post_graphql(query, variables)
- tools/no.py:270-273 (registration)Registers the no_nearest_stops tool with the MCP framework, providing name and description used for tool schema.@mcp.tool( name="no_nearest_stops", description="Find nearest StopPlaces for a coordinate (lat, lon) within a radius in meters." )
- server.py:52-52 (registration)Invokes the registration of Norwegian tools (including no_nearest_stops) on the main MCP server instance.no_tools = register_no_tools(mcp)