be_search_stations
Search for Belgian train stations by name to find station information for public transport planning.
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 via fetch_json, 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)Registers the 'be_search_stations' tool with the MCP server using the @mcp.tool decorator, specifying name and description.@mcp.tool( name="be_search_stations", description="Search for Belgian train stations by name." )
- tools/be.py:107-112 (registration)Includes 'be_search_stations' in the list of tools returned by register_be_tools(mcp), completing the registration process.return [ be_search_connections, be_search_stations, be_get_departures, be_get_vehicle ]