be_search_stations
Search for Belgian train stations by name using a query string. This tool helps locate public transport stations within Belgium efficiently.
Instructions
Search for Belgian train stations by name.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Implementation Reference
- tools/be.py:56-67 (handler)The main handler function for the 'be_search_stations' tool. It validates the query, constructs API parameters, fetches station data from the iRail API, and handles errors.async def be_search_stations(query: str) -> Dict[str, Any]: if not query or not query.strip(): raise ValueError("Station search query cannot be empty") params = {"input": query.strip(), "format": "json"} try: logger.info(f"Searching stations for: {query.strip()}") return await fetch_json(f"{BE_BASE_URL}/stations/", params) except TransportAPIError as e: logger.error(f"Belgium station search failed: {e}", exc_info=True) raise
- tools/be.py:52-55 (registration)MCP tool registration decorator for 'be_search_stations', specifying the tool name and description.@mcp.tool( name="be_search_stations", description="Search for Belgian train stations by name." )
- tools/be.py:107-112 (registration)The 'register_be_tools' function returns a list of tool functions including 'be_search_stations' for registration with the MCP server.return [ be_search_connections, be_search_stations, be_get_departures, be_get_vehicle ]