Skip to main content
Glama

get_train_positions

Read-onlyIdempotent

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

NameRequiredDescriptionDefault
limitNoMaximum number of trains to return (1-100)
latitudeNoLatitude of the centre of a radius search (requires longitude)
radiusKmNoSearch radius in kilometres (0.5-100, default 10)
longitudeNoLongitude of the centre of a radius search (requires latitude)
trainNumberNoTrain number to locate, e.g. "421" (matched against both the advertised and the operational train number)
maxAgeMinutesNoIgnore positions reported longer ago than this many minutes (1-60, default 10)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.1

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, openWorldHint and destructiveHint=false, so the safety profile is covered. The description adds genuinely new behavior: results are filtered to positions reported within maxAgeMinutes, and failures surface as isError: true when TRAFIKVERKET_API_KEY is missing/invalid or the upstream API is unreachable. It stops short of describing pagination or empty-result behavior for radius searches, which keeps it from a 5.

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?

Four sentences, front-loaded with what the tool returns before the invocation modes, then the freshness constraint, then the alternative and error/coverage notes. No restatement of the tool name and no filler.

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 read-only, six-parameter tool with no output schema, the description covers the return fields, the freshness filter, the coordinate coverage boundary (Sweden only), and the failure mode. An agent can call it correctly and interpret an error result without further context.

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 baseline is 3, but the description adds the combination semantics the schema cannot express: trainNumber and the latitude/longitude/radiusKm triple can be used together with AND behavior ("or both"). It also reinforces the recency filter that gives maxAgeMinutes its meaning. The limit parameter's role remains schema-only.

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?

Opens with a specific verb and resource ("Get live GPS positions of Swedish trains") and immediately enumerates the returned data: coordinates, speed in km/h, direction in degrees, and report timestamp. It also distinguishes itself from the sibling get_train_announcements, so an agent can choose without opening either schema.

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?

States three concrete invocation modes — locate one train by train number, list trains within a radius of a point, or both — and names the explicit alternative (get_train_announcements) with the condition that selects it (timetable and delay data at a station). Nothing is left to inference.

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