Skip to main content
Glama

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
NameRequiredDescriptionDefault
queryYes

Implementation Reference

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

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