Skip to main content
Glama

list_stations

Retrieve a complete list of Caltrain stations to ensure accurate station names for train schedules. Use this tool to resolve 'Station not found' errors in next_trains() queries.

Instructions

List all available Caltrain stations.

This tool is useful when you need to find the exact station names, especially if the next_trains() tool returns a "Station not found" error. Station names are case-insensitive and support some common abbreviations like 'SF' and 'SJ'.

Returns a formatted list of all Caltrain stations that can be used as origin or destination in the next_trains() tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_stations' tool. It is registered via the @mcp.tool() decorator and implements the logic to list all Caltrain stations using GTFS data.
    @mcp.tool()
    async def list_stations() -> str:
        """List all available Caltrain stations.
    
        This tool is useful when you need to find the exact station names, especially if
        the next_trains() tool returns a "Station not found" error. Station names are
        case-insensitive and support some common abbreviations like 'SF' and 'SJ'.
    
        Returns a formatted list of all Caltrain stations that can be used as origin
        or destination in the next_trains() tool.
        """
        try:
            stations = gtfs.list_all_stations(gtfs.get_default_data())
            stations_list = "\n".join([f"• {station}" for station in stations])
            return f"Available Caltrain stations:\n{stations_list}\n\nNote: Station names support common abbreviations like 'SF' for San Francisco and 'SJ' for San Jose."
        except Exception as e:
            return f"Error: {str(e)}"
  • Helper function that extracts and returns the sorted list of all station names from the GTFS data.
    def list_all_stations(data: GTFSData) -> list[str]:
        """Get a list of all available Caltrain stations."""
        return data.stations["stop_name"].sort_values().tolist()
  • Cached function to load and provide the default GTFS data used by list_stations.
    @lru_cache(maxsize=1)
    def get_default_data() -> GTFSData:
        """Load GTFS data on first use and cache the result."""
        return load_gtfs_data()
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses key behavioral traits: station names are 'case-insensitive and support some common abbreviations like 'SF' and 'SJ',' and it returns a 'formatted list.' However, it lacks details on potential limitations like rate limits, error handling, or data freshness. Given the absence of annotations, this is good but not exhaustive.

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 well-structured and concise, with three paragraphs that each serve a clear purpose: stating the tool's function, providing usage context, and explaining the output's utility. Every sentence adds value without redundancy, and it is front-loaded with the core purpose.

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

Completeness4/5

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

Given the tool's low complexity (0 parameters, no annotations, no output schema), the description is largely complete. It covers purpose, usage, behavioral traits, and output format. However, it could be slightly more complete by mentioning any potential errors or constraints, but for a simple list tool, this is sufficient.

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

Parameters4/5

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

The tool has 0 parameters, with 100% schema description coverage (since there are no parameters to describe). The description does not need to compensate for any parameter gaps. It appropriately focuses on the tool's function and output, making a baseline score of 4 suitable as it adds value beyond the empty schema.

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

Purpose5/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: 'List all available Caltrain stations.' It specifies the verb ('List') and resource ('Caltrain stations'), and distinguishes it from its sibling tool 'next_trains' by explaining its role in providing station names for use with that tool. This is specific and avoids tautology.

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool: 'when you need to find the exact station names, especially if the next_trains() tool returns a "Station not found" error.' It provides a clear alternative context (using it to resolve errors from the sibling tool) and specifies that the output can be used as origin or destination in next_trains(). This offers comprehensive guidance on usage versus alternatives.

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

Related 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/davidyen1124/caltrain-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server