Skip to main content
Glama
mirodn

mcp-server-public-transport

be_get_vehicle

Retrieve detailed information about a specific Belgian train vehicle using its unique ID to access operational data and specifications.

Instructions

Get details about a specific Belgian train vehicle by its ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
vehicle_idYes

Implementation Reference

  • The main handler function that fetches details for a Belgian train vehicle by ID using the iRail API.
    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 tool with 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."
    )
  • tools/be.py:107-112 (registration)
    Includes the be_get_vehicle function in the list of tools returned by register_be_tools.
    return [
        be_search_connections,
        be_search_stations,
        be_get_departures,
        be_get_vehicle
    ]
  • server.py:51-51 (registration)
    Calls register_be_tools to register all BE tools, including be_get_vehicle, with the MCP server instance.
    be_tools = register_be_tools(mcp)

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