Skip to main content
Glama
KallivdH

NS Travel Information Server

by KallivdH

get_station_info

Retrieve detailed Dutch railway station information including schedules, delays, and service details to plan train travel in the Netherlands.

Instructions

Get detailed information about a train station

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesStation name or code to search for
includeNonPlannableStationsNoInclude stations where trains do not stop regularly
limitNoMaximum number of results to return

Implementation Reference

  • Core implementation of the get_station_info tool handler, which queries the NS stations API endpoint with the provided query, optional flags, and limit.
    async getStationInfo(args: StationInfoArgs): Promise<StationInfoResponse> {
      this.ensureApiKeyConfigured();
      const response = await this.axiosInstance.get<StationInfoResponse>(
        NSApiService.ENDPOINTS.STATIONS,
        {
          params: {
            q: args.query,
            includeNonPlannableStations: args.includeNonPlannableStations ?? false,
            limit: args.limit ?? 10
          }
        }
      );
      return response.data;
    }
  • TypeScript interface definition and type guard validator for the input arguments of get_station_info.
    export interface StationInfoArgs {
      query: string;
      includeNonPlannableStations?: boolean;
      limit?: number;
    }
    
    export function isValidStationInfoArgs(args: any): args is StationInfoArgs {
      return (
        typeof args === 'object' &&
        typeof args.query === 'string' &&
        (args.includeNonPlannableStations === undefined || typeof args.includeNonPlannableStations === 'boolean') &&
        (args.limit === undefined || (typeof args.limit === 'number' && args.limit >= 1 && args.limit <= 50))
      );
    }
  • TypeScript interface definition for the output response of get_station_info.
    export interface StationInfoResponse {
      payload: Station[];
    }
  • src/index.ts:149-174 (registration)
    MCP tool registration in the stdio server (index.ts), including name, description, and JSON input schema.
    {
      name: 'get_station_info',
      description: 'Get detailed information about a train station',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Station name or code to search for',
          },
          includeNonPlannableStations: {
            type: 'boolean',
            description: 'Include stations where trains do not stop regularly',
            default: false
          },
          limit: {
            type: 'number',
            description: 'Maximum number of results to return',
            minimum: 1,
            maximum: 50,
            default: 10
          }
        },
        required: ['query']
      }
    },
  • MCP tool registration in the HTTP server (http-server.ts), including name, description, and JSON input schema.
    {
      name: 'get_station_info',
      description: 'Get detailed information about a train station',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Station name or code to search for',
          },
          includeNonPlannableStations: {
            type: 'boolean',
            description: 'Include stations where trains do not stop regularly',
            default: false
          },
          limit: {
            type: 'number',
            description: 'Maximum number of results to return',
            minimum: 1,
            maximum: 50,
            default: 10
          }
        },
        required: ['query']
      }
    },

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