be_get_vehicle
Retrieve detailed information about a Belgian train vehicle using its unique ID with this public transport data tool. Query and access specifics locally or across Europe via the MCP server.
Instructions
Get details about a specific Belgian train vehicle by its ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vehicle_id | Yes |
Implementation Reference
- tools/be.py:94-105 (handler)The main handler function that executes the tool logic: validates vehicle_id, constructs API params, fetches JSON from iRail vehicle endpoint, and handles errors.async def be_get_vehicle(vehicle_id: str) -> Dict[str, Any]: if not vehicle_id or not vehicle_id.strip(): raise ValueError("Vehicle ID must be provided for vehicle lookup") params = {"id": vehicle_id.strip(), "format": "json"} try: logger.info(f"Fetching vehicle info: {vehicle_id.strip()}") return await fetch_json(f"{BE_BASE_URL}/vehicle/", params) except TransportAPIError as e: logger.error(f"Belgium vehicle fetch failed: {e}", exc_info=True) raise
- tools/be.py:90-93 (registration)Registers the 'be_get_vehicle' tool with the MCP server using the @mcp.tool decorator, specifying name and description.@mcp.tool( name="be_get_vehicle", description="Get details about a specific Belgian train vehicle by its ID." )
- server.py:51-51 (registration)Calls register_be_tools(mcp) in the main server initialization, which triggers the registration of BE tools including 'be_get_vehicle'.be_tools = register_be_tools(mcp)