Skip to main content
Glama
mirodn

mcp-server-public-transport

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
NameRequiredDescriptionDefault
latYes
lonYes
radiusNo
limitNo

Implementation Reference

  • 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)

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