Skip to main content
Glama

get_replacement_traffic

Read-onlyIdempotent

Fetch replacement buses, coaches, or taxis for cancelled Swedish trains, including stops, times, delays, and wheelchair access; filter by station, replaced train number, or departure date.

Instructions

Get replacement traffic (ersättningstrafik) for Swedish trains: the buses, coaches or taxis that run instead of cancelled trains, with the replaced train numbers, vehicle type, status (planned, ordered, confirmed, running, finished, canceled), wheelchair access, toilet, and every stop with stop description (where to board), planned/expected/actual times, delay in minutes and traveller notes. Filter by station (name or signature; the stop there is returned as atStation), by replaced train number, and/or by the replaced train's departure date; otherwise trips from minutesBack before now to hoursAhead after now. Operators report this voluntarily, so not every replacement is listed: use get_train_announcements to see which trains are cancelled and get_train_messages for the disruption behind them. fetchedAt is when this server got the response from Trafikverket; the result does not refresh afterwards, so call the tool again if fetchedAt is old. lastUpdated is when Trafikverket last changed the record: an old value does not necessarily mean stale data, and it does not confirm that the data is still current. Returns an error result (isError: true) if TRAFIKVERKET_API_KEY is missing/invalid or the Trafikverket API is unreachable. Coverage: Sweden only (Trafikverket data).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "get_replacement_traffic"
  }
}

Input Schema

NameRequiredDescriptionDefault
dateNoDeparture date (YYYY-MM-DD) of the replaced train. When set, the whole day is searched and minutesBack/hoursAhead are ignored
limitNoMaximum number of trips to return (1-50)
stationNoOnly trips stopping at this station: name (e.g. "Lund C", "Malmö") or location signature (e.g. "Lu")
hoursAheadNoInclude trips departing up to this many hours after now (0.5-48, default 12)
minutesBackNoInclude trips still running or departing up to this many minutes before now (0-240, default 30)
trainNumberNoOnly trips replacing this advertised train number, e.g. "1043"

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.1

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already cover read-only, idempotent, open-world, and non-destructive behavior, but the description adds substantial operational context: operators report voluntarily so coverage is incomplete, fetchedAt is a non-refreshing fetch time, lastUpdated does not confirm currentness, and errors occur when the API key is missing/invalid or the API is unreachable.

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

Conciseness4/5

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

The description is dense and long, but it is front-loaded with the tool's purpose and then proceeds through output fields, filtering behavior, caveats, error conditions, and coverage. Most sentences carry useful information, though the single-paragraph format makes some operational caveats harder to scan.

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?

There is no output schema, so the description must explain return content, and it does: replaced train numbers, vehicle type, status values, accessibility, toilet, stop descriptions, timing fields, delay, and traveller notes. It also covers filtering, default time windows, optional data limitations, freshness semantics, error behavior, and geographic coverage.

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?

Schema coverage is 100%, so the schema already documents parameter meanings. The description adds some extra semantics beyond the schema, notably that the station stop is returned as atStation and that filtering by the replaced train's departure date interacts with the time-window parameters.

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 states a specific verb and resource: get replacement traffic for Swedish trains, defined as buses/coaches/taxis replacing cancelled trains. It distinguishes the tool from siblings by naming get_train_announcements for cancellations and get_train_messages for disruption context.

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?

It gives explicit usage guidance: filter by station, replaced train number, and/or departure date; otherwise query from minutesBack before now to hoursAhead after now. It also names alternatives for related questions, telling the agent to use get_train_announcements for cancelled trains and get_train_messages for the disruption behind them.

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