Skip to main content
Glama

Next Transit Departures

transit_next_departures
Read-onlyIdempotent

Get real-time departure predictions for a transit stop, showing minutes until the next bus or train and the expected clock time. Filter by line or limit results to know exactly when the next vehicle arrives.

Instructions

Live arrival predictions for the next vehicles at a stop.

This is the tool for "when is my next train/bus". It returns real-time predictions, not the printed timetable, and reports minutes-from-now alongside Pacific clock time.

Args:

  • operator_id (string): agency code from transit_list_operators, e.g. 'BA', 'SF'

  • stop_code (string): stop code from transit_find_stops. Codes belong to ONE operator and are not interchangeable between agencies

  • line (string): only departures on this line, matched on name or id

  • limit (number): maximum departures to return (default: 10)

  • response_format ('markdown' | 'json'): output format (default: 'markdown')

Returns: { "count": number, "total": number, "truncated": boolean, "operator": string, "stop_code": string, "stop_name": string, "retrieved_at": string, "departures": [ { "line": string, "destination": string, "expected": string, "aimed": string, "minutes": number, "vehicle": string | null, "at_stop": boolean } ] }

Examples:

  • "When's the next N Judah?" -> operator_id='SF', stop_code from transit_find_stops, line='N'

  • "Next BART from Downtown Berkeley?" -> operator_id='BA', the stop's code

  • Don't use when: you want the scheduled timetable rather than live predictions

Error Handling:

  • An empty result usually means service has ended for the night, or the stop is a route's final stop — 511 omits arrival-only terminals from this feed

  • Predictions extend roughly 90 minutes ahead; nothing beyond that appears

  • Rows reading "scheduled only, no live prediction" have no vehicle assigned yet

  • 511 allows 60 requests per hour across ALL endpoints — never poll this in a loop

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lineNoOnly departures on this line, matched against the line name or id
limitNoMaximum results to return (max 200)
stop_codeYesStop code from transit_find_stops. Codes are specific to one operator
operator_idYesOperator code from transit_list_operators, e.g. 'BA' for BART, 'SF' for Muni
response_formatNoOutput format: 'markdown' for human-readable, 'json' for machine-readablemarkdown

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
countYes
totalYes
operatorNo
stop_codeNo
stop_nameNo
truncatedYes
departuresYes
retrieved_atNo
Behavior5/5

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

Annotations already declare readOnly, idempotent, and non-destructive hints. The description adds substantial behavioral context: real-time vs static, minutes-from-now plus Pacific clock time, 'scheduled only' rows, a 90-minute prediction horizon, empty results meaning (end of service or arrival-only terminal), and a 60-requests-per-hour rate limit. This goes far beyond the annotations, providing critical operational details an agent needs to interpret results and avoid misuse.

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?

Structured with clear sections (Purpose, Args, Returns, Examples, Error Handling) and front-loaded with the core purpose. Every sentence adds value; error handling is critical for correct agent behavior. It is detailed but not flabby — the length is justified by the operational caveats and edge cases.

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

Completeness5/5

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

For a tool with 5 parameters and an output schema, the description covers all essential usage aspects: parameter semantics, error scenarios (empty results, truncated predictions), time horizon, rate limits, and a full output structure in the Returns section. Even though an output schema is provided, the description's explicit sample JSON and explanation of fields further aid the agent. Nothing needed for correct invocation is missing.

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

Parameters5/5

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

Even though schema coverage is 100%, the description enriches every parameter: it provides real examples (operator_id 'BA'/'SF', stop_code from transit_find_stops), warns that stop codes are operator-specific and not interchangeable, clarifies line matching ('matched on name or id'), and explains response_format options. The Args section adds value beyond the schema's terse descriptions, especially for stop_code and line.

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?

Description states a specific verb and resource: 'Live arrival predictions for the next vehicles at a stop' and explicitly positions it as 'the tool for when is my next train/bus'. It distinguishes from the printed timetable and clarifies scope (real-time, not static), making it clearly different from sibling tools that list operators, stops, lines, vehicles, or alerts.

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?

Provides explicit when-to-use guidance via examples ('When's the next N Judah?' maps to specific parameters), an explicit 'Don't use when' exclusion for scheduled timetable, and references prerequisite tools (transit_list_operators, transit_find_stops) for parameter sourcing. It also includes rate-limit guidance ('never poll this in a loop'), which is directly relevant to usage.

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/RyK57/transit-mcp-server'

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