Skip to main content
Glama
KallivdH

NS Travel Information Server

by KallivdH

get_arrivals

Retrieve real-time train arrival information for Dutch railway stations, including platform numbers, delays, and origin details. Use station codes or UIC codes to get upcoming arrivals with timing and status updates.

Instructions

Get real-time arrival information for trains at a specific station, including platform numbers, delays, origin stations, and any relevant travel notes. Returns a list of upcoming arrivals with timing, origin, and status information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stationNoNS Station code for the station (e.g., ASD for Amsterdam Centraal). Required if uicCode is not provided
uicCodeNoUIC code for the station. Required if station code is not provided
dateTimeNoFormat - date-time (as date-time in RFC3339). Only supported for arrivals at foreign stations. Defaults to server time (Europe/Amsterdam)
maxJourneysNoNumber of arrivals to return
langNoLanguage for localizing the arrivals list. Only a small subset of text is translated, mainly notes. Defaults to Dutchnl

Implementation Reference

  • Core handler function in NSApiService that executes the logic to fetch real-time train arrivals from the NS API endpoint using axios, with input validation via ensureApiKeyConfigured.
    async getArrivals(args: GetArrivalsArgs): Promise<ArrivalsResponse> {
      this.ensureApiKeyConfigured();
      const response = await this.axiosInstance.get<ArrivalsResponse>(
        NSApiService.ENDPOINTS.ARRIVALS,
        {
          params: {
            station: args.station,
            uicCode: args.uicCode,
            dateTime: args.dateTime,
            maxJourneys: args.maxJourneys,
            lang: args.lang
          },
        }
      );
      return response.data;
    }
  • TypeScript interface defining input args for get_arrivals tool and type guard function for input validation.
    export interface GetArrivalsArgs {
      station?: string;
      uicCode?: string;
      dateTime?: string;
      maxJourneys?: number;
      lang?: string;
    }
    
    export function isValidArrivalsArgs(args: unknown): args is GetArrivalsArgs {
      if (!args || typeof args !== "object") {
        return false;
      }
    
      const typedArgs = args as Record<string, unknown>;
    
      // Either station or uicCode must be provided
      if (!typedArgs.station && !typedArgs.uicCode) {
        return false;
      }
    
      // Check station: should be undefined or string
      if (typedArgs.station !== undefined && typeof typedArgs.station !== "string") {
        return false;
      }
    
      // Check uicCode: should be undefined or string
      if (typedArgs.uicCode !== undefined && typeof typedArgs.uicCode !== "string") {
        return false;
      }
    
      // Check dateTime: should be undefined or string
      if (typedArgs.dateTime !== undefined && typeof typedArgs.dateTime !== "string") {
        return false;
      }
    
      // Check maxJourneys: should be undefined or number between 1 and 100
      if (typedArgs.maxJourneys !== undefined) {
        if (typeof typedArgs.maxJourneys !== "number" || 
            typedArgs.maxJourneys < 1 || 
            typedArgs.maxJourneys > 100) {
          return false;
        }
      }
    
      // Check lang: should be undefined or 'nl' or 'en'
      if (typedArgs.lang !== undefined) {
        if (typeof typedArgs.lang !== "string" || !["nl", "en"].includes(typedArgs.lang)) {
          return false;
        }
      }
    
      return true;
    }
  • src/index.ts:184-219 (registration)
    Tool registration in the stdio MCP server (index.ts), including name, description, and JSON schema for input validation.
    name: 'get_arrivals',
    description: 'Get real-time arrival information for trains at a specific station, including platform numbers, delays, origin stations, and any relevant travel notes. Returns a list of upcoming arrivals with timing, origin, and status information.',
    inputSchema: {
      type: 'object',
      properties: {
        station: {
          type: 'string',
          description: 'NS Station code for the station (e.g., ASD for Amsterdam Centraal). Required if uicCode is not provided',
        },
        uicCode: {
          type: 'string',
          description: 'UIC code for the station. Required if station code is not provided',
        },
        dateTime: {
          type: 'string',
          description: 'Format - date-time (as date-time in RFC3339). Only supported for arrivals at foreign stations. Defaults to server time (Europe/Amsterdam)',
        },
        maxJourneys: {
          type: 'number',
          description: 'Number of arrivals to return',
          minimum: 1,
          maximum: 100,
          default: 40
        },
        lang: {
          type: 'string',
          description: 'Language for localizing the arrivals list. Only a small subset of text is translated, mainly notes. Defaults to Dutch',
          enum: ['nl', 'en'],
          default: 'nl'
        }
      },
      oneOf: [
        { required: ['station'] },
        { required: ['uicCode'] }
      ]
    }
  • src/index.ts:350-359 (registration)
    Dispatch handler in stdio MCP server that validates args using type guard and delegates to NSApiService.getArrivals.
    case 'get_arrivals': {
      if (!isValidArrivalsArgs(rawArgs)) {
        throw ResponseFormatter.createMcpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for get_arrivals'
        );
      }
      const data = await this.nsApiService.getArrivals(rawArgs);
      return ResponseFormatter.formatSuccess(data);
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's function and output format, but lacks details on potential limitations (e.g., rate limits, data freshness, error handling) or prerequisites (e.g., authentication needs). The description does not contradict any annotations, as none are provided.

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?

The description is appropriately sized and front-loaded, with the first sentence clearly stating the core purpose. Both sentences earn their place by adding value: the first defines the tool's function and scope, and the second specifies the return format. There is no redundant or wasted information.

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?

Given the tool's moderate complexity (5 parameters, no output schema, no annotations), the description is reasonably complete. It covers the tool's purpose, scope, and return format, but could improve by addressing behavioral aspects like rate limits or error handling. The lack of an output schema means the description's detail on return values is helpful, though not exhaustive.

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 the input schema already documents all parameters thoroughly. The description does not add any parameter-specific semantics beyond what the schema provides (e.g., it doesn't clarify station code formats or date-time usage). However, it implies the tool's purpose aligns with the parameters, maintaining the baseline score for high schema coverage.

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 clearly states the tool's purpose with specific verbs ('Get real-time arrival information') and resources ('trains at a specific station'), distinguishing it from siblings like get_departures (which handles departures) and get_station_info (which provides static station details). It explicitly mentions what information is included (platform numbers, delays, origin stations, travel notes) and the return format (list of upcoming arrivals).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by specifying 'real-time arrival information for trains at a specific station,' which helps differentiate it from siblings like get_disruptions (disruption info) or get_travel_advice (route planning). However, it does not explicitly state when NOT to use this tool or name specific alternatives, such as using get_departures for departure data instead.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/KallivdH/ns-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server