Skip to main content
Glama

Search trains

mb_search_trains
Read-onlyIdempotent

Search train options between two stations on a specific date, listing each class, adult price, and available seats for comparison.

Instructions

Trains between two stations on a date with every class (wagon), its price per adult and free seats.

price_toman is per adult; for children, infants or a compartment call mb_train_price with the class_id. Top-level refund_penalties apply to every class unless it lists its own. Stops: mb_train_stops. No seats: mb_train_price_calendar or mb_alternative_routes. A round trip is two calls (return leg with outbound_class_id).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "origin": "<origin>",
      "destination": "<destination>",
      "date": "<date>"
    },
    "name": "mb_search_trains"
  }
}

Input Schema

NameRequiredDescriptionDefault
dateYesTravel date YYYY-MM-DD (sales open about 18 days ahead).
sortNoOrder of the trains.earliest
limitNoMax trains.
quotaNoSeat quota: general (mixed), men, women, or car transport.general
originYesTrain station id from mb_find_place(mode='train'), e.g. 1 (Tehran).
destinationYesTrain station id from mb_find_place(mode='train'), e.g. 1 (Tehran).
available_onlyNoHide sold-out classes and trains with no free seat.
outbound_class_idNoReturn leg of a round trip only: the outbound class_id (limits the return to the same rail company).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv0.5.0
    • changedInput schema / properties / date / description
      Previous value: -"Travel date YYYY-MM-DD, e.g. '2026-10-14'. Sales open about 18 days ahead."New value: +"Travel date YYYY-MM-DD (sales open about 18 days ahead)."
    • changedInput schema / properties / destination / description
      Previous value: -"Train station id from mb_find_place(mode='train'), e.g. 1 (Tehran) or 191 (Mashhad)."New value: +"Train station id from mb_find_place(mode='train'), e.g. 1 (Tehran)."
    • changedInput schema / properties / origin / description
      Previous value: -"Train station id from mb_find_place(mode='train'), e.g. 1 (Tehran) or 191 (Mashhad)."New value: +"Train station id from mb_find_place(mode='train'), e.g. 1 (Tehran)."
    • removedInput schema / properties / outbound_class_id / anyOf
      Removed value: -[
      -  {
      -    "minimum": 1,
      -    "type": "integer"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • changedInput schema / properties / outbound_class_id / description
      Previous value: -"Round trip, return leg only: the class_id chosen on the outbound leg, e.g. 9847134 (limits the return to the same rail company, as the site does)."New value: +"Return leg of a round trip only: the outbound class_id (limits the return to the same rail company)."
    • addedInput schema / properties / outbound_class_id / minimum
      Added value: +1
    • addedInput schema / properties / outbound_class_id / type
      Added value: +[
      +  "integer",
      +  "null"
      +]
    • changedInput schema / properties / quota / description
      Previous value: -"Seat quota: general (families, mixed), men only, women only, or car transport."New value: +"Seat quota: general (mixed), men, women, or car transport."
    • removedInput schema / title
      Removed value: -"mb_search_trainsArguments"
  2. Changed9 schema fields changedv0.3.0
    • removedInput schema / properties / available_only / title
      Removed value: -"Available Only"
    • removedInput schema / properties / date / title
      Removed value: -"Date"
    • removedInput schema / properties / destination / title
      Removed value: -"Destination"
    • removedInput schema / properties / limit / title
      Removed value: -"Limit"
    • removedInput schema / properties / origin / title
      Removed value: -"Origin"
    • removedInput schema / properties / outbound_class_id / title
      Removed value: -"Outbound Class Id"
    • removedInput schema / properties / quota / title
      Removed value: -"Quota"
    • removedInput schema / properties / sort / title
      Removed value: -"Sort"
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": true,
      -  "title": "mb_search_trainsDictOutput",
      -  "type": "object"
      -}New value: +null
  3. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, openWorld and non-destructive, so the safety profile is covered; the description adds genuinely new behavior — that price_toman is per adult only, and that top-level refund_penalties apply to every class unless a class overrides them. The gap is that it says nothing about result volume, pagination or what an empty result looks like beyond the pointer to alternatives.

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?

Purpose is front-loaded in the first sentence, followed by compact routing rules; the telegraphic fragments ('Stops: mb_train_stops.') are unambiguous in context and every sentence carries either purpose or a follow-up decision. Nothing is repeated from the schema or annotations.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/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 correctly carries the return shape (classes, per-adult price, free seats, refund penalties) and covers the main follow-up paths for an 8-parameter search tool. It stops short of describing ordering/limit effects on the response or the out-of-window date behavior hinted at only in the schema.

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 meaning the schema does not: the returned price is per-adult (implying children need a separate mb_train_price call), and class_id is a value from this response used for follow-up calls. It does not add anything about quota, sort or limit, which the schema already handles well.

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 opening sentence states a specific verb (search), resource (trains), scope (between two stations on a date) and the payload (every class/wagon with price per adult and free seats). That is enough to distinguish it from mb_search_buses and mb_search_flights without opening any 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?

It routes the agent explicitly: children/infant/compartment pricing goes to mb_train_price with the class_id, stops go to mb_train_stops, and a no-seat result goes to mb_train_price_calendar or mb_alternative_routes. It also states the round-trip pattern (two calls, return leg with outbound_class_id), which is the kind of procedural guidance agents usually get wrong.

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