Get first-stop departure predictions (incl. late-evening trips)
bus_get_timetableGet first-stop bus departure times for a line and find the next departure after a chosen time, including late-evening service from previous days' schedules.
Instructions
Per-trip departures from the line's FIRST stop — answers "when does the next bus leave the origin terminal".
Today's predicted departures are a rolling window covering only roughly the next two hours, so the last trip of the service day is never included. This tool therefore also returns yesterdayDepartures / dayBeforeDepartures, the previous two service days' complete actual schedules, and resolves nextDeparture against them so late-evening queries still get an answer.
Pass at_time ("HH:MM", Beijing time) to ask "what is the next departure after 19:10" instead of using the current clock.
Args:
city_id (string, required)
line_id (string, required)
line_no (string, required): rider-facing short name from bus_search.lines[].name (e.g. '71'). NOT the internal lineNo like 'r95817'.
direction ('0'|'1'): the line direction
at_time ('HH:MM', optional): reference clock; defaults to now in Asia/Shanghai
response_format ('markdown' | 'json')
Returns (json): { "line": { "lineId":"...", "name":"71", "direction":1, "startSn":"...", "endSn":"..." }, "mode": "scheduled", "nextDeparture": "20:00", "nextDepartureSource": "yesterday-actual", "lastPredictedDeparture": "20:00", "firstStopDepartures": ["06:30", "06:45", "..."], "segments": [{ "fromTime":"06:30", "toTime":"10:00", "intervalMin":18, "departures":[...] }, ...], "yesterdayDepartures": ["06:30", ..., "21:00"], "dayBeforeDepartures": ["06:30", ..., "20:59"], "depTitle": "首站发车预测" }
Some lines run at a fixed headway with no per-trip data (mode='interval'); for those use bus_get_line_detail to read firstTime/lastTime.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"city_id": "<city_id>",
"line_id": "<line_id>",
"line_no": "<line_no>",
"direction": "<direction>"
},
"name": "bus_get_timetable"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| at_time | No | Answer 'what is the next departure after this time' instead of using the current clock. Useful for planning a later trip, e.g. '19:10'. | |
| city_id | Yes | ||
| line_id | Yes | ||
| line_no | Yes | Rider-facing short name (search.lines[].name), e.g. '71'. NOT the internal lineNo like 'r95817'. | |
| direction | Yes | ||
| response_format | No | Output format: 'markdown' for human-readable text, 'json' for full structured data | markdown |