Skip to main content
Glama

get_timetable

Retrieve bus schedules for any station in Nagoya using the station number to plan your journey and check departure times.

Instructions

Get timetable for a given station.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
station_numberYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Registration of the get_timetable tool with the FastMCP server.
    mcp_server.tool(get_timetable)
  • Pydantic schemas for the timetable data structures used in get_timetable response.
    class TimeTable(BaseModel):
        route: Annotated[str, Field(description="路線")]
        direction: Annotated[str, Field(description="方面")]
        pole: Annotated[str, Field(description="乗り場")]
        stop_stations: Annotated[list[str], Field(description="停車バス停のリスト")]
        timetable: Annotated[dict[str, list[str]], Field(description="曜日別の時刻表")]
        url: str
    
    
    class TimeTableResponse(BaseModel):
        station_number: int
        timetables: list[TimeTable]
        url: str
  • The core handler function that implements the get_timetable tool logic: retrieves station diagram from client, processes it into TimeTable entries, and returns TimeTableResponse.
    async def get_timetable(ctx: Context, station_number: int) -> TimeTableResponse | None:
        """Get timetable for a given station."""
        client = ctx.request_context.lifespan_context.bus_client
    
        station_name = (await _get_station_numbers(client)).get(station_number)
        if station_name is None:
            log.warning("Station number %s not found", station_number)
            return None
    
        log.info("Getting timetable for station number %s", station_number)
        diagram_response = await client.get_station_diagram(station_number)
        if not diagram_response.root:
            log.error(
                "Failed to get station diagram for %s (%s)", station_name, station_number
            )
            return None
    
        timetables: list[TimeTable] = []
        for line, railways in diagram_response.root.items():
            for railway_index, railway in enumerate(railways):
                diagram: dict[str, list[str]] = {}
                for day, hour_minutes in railway.diagram.root.items():
                    diagram[day] = []
                    for hour, minutes in hour_minutes.items():
                        for minute in minutes:
                            diagram[day].append(f"{hour}:{minute:02}")
                timetables.append(
                    TimeTable(
                        route=line,
                        direction="・".join(railway.railway),
                        stop_stations=reduce(iadd, railway.stations, []),
                        pole=railway.polename,
                        timetable=diagram,
                        url=f"{client.base_url}/jp/pc/bus/timetable_dtl.html?name={station_name}&keito={line}&lineindex={railway_index}",
                    )
                )
    
        return TimeTableResponse(
            timetables=timetables,
            station_number=station_number,
            url=f"{client.base_url}/jp/pc/bus/timetable_list.html?name={station_name}&toname=",
        )
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 states the action ('Get timetable') but doesn't describe whether this is a read-only operation, if it requires authentication, rate limits, error conditions, or what the output looks like. The description is minimal and lacks behavioral context beyond the basic action.

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 a single, efficient sentence with zero waste. It's front-loaded and appropriately sized for a simple tool, making it easy 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 the tool has one parameter and an output schema exists (which should cover return values), the description is minimally adequate. However, with no annotations and low schema coverage, it lacks context on usage, behavioral traits, and parameter details, making it incomplete for optimal agent understanding.

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

Parameters2/5

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

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description mentions 'for a given station' but doesn't explain what 'station_number' represents (e.g., format, range, examples) or how it relates to the timetable. It adds minimal value beyond implying a station identifier is needed.

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 verb ('Get') and resource ('timetable') with the target ('for a given station'), making the purpose understandable. However, it doesn't differentiate from the sibling tool 'get_station_number', which appears related but serves a different function (getting station number vs. timetable).

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, context for usage, or exclusions, leaving the agent to infer usage based solely on the tool name and parameter.

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/ymyzk/nagoya-bus-mcp'

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