Skip to main content
Glama
mirodn

mcp-server-public-transport

be_search_connections

Find train routes and schedules between Belgian stations using real-time data from iRail API.

Instructions

Search train connections in Belgium between two stations. Powered by iRail API for real-time routes and schedules.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
originYes
destinationYes
resultsNo
dateNo
timeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function that implements the logic for searching train connections in Belgium using the iRail API. It validates inputs, constructs API parameters, fetches data from the connections endpoint, and handles errors.
    async def be_search_connections(
        origin: str,
        destination: str,
        results: Optional[int] = 4,
        date: Optional[str] = None,
        time: Optional[str] = None
    ) -> Dict[str, Any]:
        if not origin or not origin.strip() or not destination or not destination.strip():
            raise ValueError("Origin and destination must be provided and non-empty")
        if origin.strip() == destination.strip():
            raise ValueError("Origin and destination must be different")
    
        params: Dict[str, Any] = {
            "from": origin.strip(),
            "to": destination.strip(),
            "format": "json",
            "results": results or 4
        }
        if date:
            params["date"] = date
        if time:
            params["time"] = time
    
        try:
            logger.info(f"Searching connections: {origin.strip()} → {destination.strip()}")
            return await fetch_json(f"{BE_BASE_URL}/connections/", params)
        except TransportAPIError as e:
            logger.error(f"Belgium connection search failed: {e}", exc_info=True)
            raise
  • tools/be.py:15-21 (registration)
    MCP tool registration decorator defining the name and description for the be_search_connections tool.
    @mcp.tool(
        name="be_search_connections",
        description=(
            "Search train connections in Belgium between two stations. "
            "Powered by iRail API for real-time routes and schedules."
        )
    )
  • tools/be.py:108-108 (registration)
    The tool function is included in the list returned by register_be_tools for MCP server registration.
    be_search_connections,
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'real-time routes and schedules' but lacks critical details: whether this is a read-only operation, potential rate limits, authentication requirements, error handling, or data freshness. For a search tool with real-time data, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded: the first sentence states the core purpose, and the second adds API context. Both sentences earn their place with no wasted words, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 5 parameters with 0% schema coverage and an output schema exists, the description is moderately complete. It covers the basic purpose but misses parameter details and behavioral context. The output schema may handle return values, but without annotations, the description should do more to explain operational aspects like data sources or limitations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It implies parameters for origin and destination stations but doesn't explain the 'results', 'date', or 'time' parameters. The mention of 'real-time routes and schedules' hints at date/time relevance but doesn't clarify format or defaults. Baseline is 3 as it adds minimal value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Search train connections in Belgium between two stations.' It specifies the verb ('search'), resource ('train connections'), and geographic scope ('Belgium'). However, it doesn't explicitly differentiate from sibling tools like 'be_get_departures' or 'ch_search_connections' beyond the geographic distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions the iRail API but doesn't specify use cases, prerequisites, or comparisons to sibling tools like 'be_get_departures' (which might focus on departures from a single station) or 'ch_search_connections' (for Switzerland).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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