get_train_positions
Retrieve live GPS positions of Swedish trains with coordinates, speed, heading and report time; locate a train by number or list trains within a radius of a point.
Instructions
Get live GPS positions of Swedish trains: coordinates, speed (km/h), direction of travel (degrees) and when the position was reported. Locate one train by its train number, list trains within a radius of a point (latitude, longitude, radiusKm), or both. Only positions reported within the last maxAgeMinutes are returned. Use get_train_announcements for timetable and delay data at a station. 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_train_positions"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of trains to return (1-100) | |
| latitude | No | Latitude of the centre of a radius search (requires longitude) | |
| radiusKm | No | Search radius in kilometres (0.5-100, default 10) | |
| longitude | No | Longitude of the centre of a radius search (requires latitude) | |
| trainNumber | No | Train number to locate, e.g. "421" (matched against both the advertised and the operational train number) | |
| maxAgeMinutes | No | Ignore positions reported longer ago than this many minutes (1-60, default 10) |