Skip to main content
Glama

get_train_messages

Read-onlyIdempotent

Retrieve current Swedish railway traffic messages about track work, technical faults, and disruptions. Filter by county and view affected stations, sections, and event timing.

Instructions

Get current railway traffic messages from Trafikverket: track work, technical faults and other disruptions, with event type, header, description, start/expected end time, and the affected stations/sections. Optionally filter by county. Use this for "is there a disruption on the railway" questions; use get_train_announcements for per-train timetable and delay data. messageLastUpdated is when the public message shown (header and description) last changed; it can be older than the event's lastUpdated. 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_train_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum number of messages to return (1-100)
countyNoOptional county filter: Swedish county name (e.g. "Skåne", "Västra Götaland") or county code (e.g. 14)
activeOnlyNoOnly include messages that have not ended yet (default true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare readOnly/idempotent/openWorld safety; the description goes well beyond them by defining the three timestamp fields (messageLastUpdated vs fetchedAt vs lastUpdated), warning that results do not refresh after fetch and the tool must be re-called if fetchedAt is old, and that an old lastUpdated does not imply staleness. It also discloses failure behavior (isError: true when TRAFIKVERKET_API_KEY is missing/invalid or the API is unreachable). This is exactly the behavioral context annotations cannot supply.

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?

Front-loaded with purpose, then routing guidance, then field semantics and error/coverage notes — a logical order. The timestamp discussion is dense but each sentence carries distinct information; only minor tightening (e.g. merging the lastUpdated and messageLastUpdated notes) would improve it.

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?

With no output schema, the description must carry return-value semantics, and it does so precisely by explaining the three timestamp fields and the message payload structure. Combined with stated error behavior, data freshness caveat, and geographic coverage, an agent has everything needed to call and interpret results correctly.

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

Parameters3/5

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

Schema description coverage is 100%, so limit, county, and activeOnly are already documented in the schema; baseline is 3. The description only echoes the optional county filter and adds no syntax or interaction detail (e.g. how county combines with activeOnly or limit truncation) beyond what the schema provides.

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?

States a specific verb and resource ('Get current railway traffic messages from Trafikverket') and enumerates the content: track work, technical faults, other disruptions, with event type, header, description, start/expected end time, and affected stations/sections. It also explicitly 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?

Gives an explicit routing rule: 'Use this for "is there a disruption on the railway" questions; use get_train_announcements for per-train timetable and delay data.' It adds a coverage boundary (Sweden only) and notes the optional county filter, leaving no ambiguity about when this tool applies.

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