Skip to main content
Glama

be_search_connections

Find real-time train connections in Belgium between two stations using iRail API. Specify origin, destination, and optional date, time, or results limit.

Instructions

Search train connections in Belgium between two stations. Powered by iRail API for real-time routes and schedules.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNo
destinationYes
originYes
resultsNo
timeNo

Implementation Reference

  • The async handler function implementing the core logic for searching train connections between two Belgian stations using the iRail API. Includes input validation and error handling.
    async def be_search_connections( origin: str, destination: str, results: Optional[int] = 4, date: Optional[str] = None, time: Optional[str] = None ) -> Dict[str, Any]: if not origin or not origin.strip() or not destination or not destination.strip(): raise ValueError("Origin and destination must be provided and non-empty") if origin.strip() == destination.strip(): raise ValueError("Origin and destination must be different") params: Dict[str, Any] = { "from": origin.strip(), "to": destination.strip(), "format": "json", "results": results or 4 } if date: params["date"] = date if time: params["time"] = time try: logger.info(f"Searching connections: {origin.strip()} → {destination.strip()}") return await fetch_json(f"{BE_BASE_URL}/connections/", params) except TransportAPIError as e: logger.error(f"Belgium connection search failed: {e}", exc_info=True) raise
  • tools/be.py:15-21 (registration)
    The @mcp.tool decorator that registers the be_search_connections tool with the MCP server, specifying its name and description.
    @mcp.tool( name="be_search_connections", description=( "Search train connections in Belgium between two stations. " "Powered by iRail API for real-time routes and schedules." ) )
  • server.py:51-51 (registration)
    Invocation of register_be_tools(mcp) in the main server initialization, which triggers the registration of the BE tools including be_search_connections.
    be_tools = register_be_tools(mcp)

Other Tools

Related Tools

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