Skip to main content
Glama
mirodn

mcp-server-public-transport

be_get_departures

Retrieve real-time train departure information for Belgian stations to plan journeys and check schedules.

Instructions

Get live departure board for a Belgian train station.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stationYes
limitNo

Implementation Reference

  • The async handler function implementing the core logic for the be_get_departures tool, fetching live train departures from a Belgian station using the iRail API.
    async def be_get_departures(station: str, limit: Optional[int] = 10) -> Dict[str, Any]:
        if not station or not station.strip():
            raise ValueError("Station name must be provided for departures lookup")
    
        params = {
            "station": station.strip(),
            "limit": limit or 10,
            "format": "json"
        }
    
        try:
            logger.info(f"Fetching departures for station: {station.strip()}")
            return await fetch_json(f"{BE_BASE_URL}/liveboard/", params)
        except TransportAPIError as e:
            logger.error(f"Belgium liveboard fetch failed: {e}", exc_info=True)
            raise
  • tools/be.py:69-72 (registration)
    The @mcp.tool decorator that registers the be_get_departures tool with the MCP server, specifying its name and description.
    @mcp.tool(
        name="be_get_departures",
        description="Get live departure board for a Belgian train station."
    )
  • server.py:51-51 (registration)
    Call to register_be_tools(mcp) in the main server, which triggers the registration of all BE tools including be_get_departures.
    be_tools = register_be_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