Skip to main content
Glama
KallivdH

NS Travel Information Server

by KallivdH

get_station_info

Find detailed Dutch train station information including schedules, facilities, and accessibility for planning your NS railway journey 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

  • The core handler function that performs the HTTP request to the NS API stations endpoint to retrieve station information based on the query parameters.
    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; }
  • Type definitions and validation function for the input arguments (StationInfoArgs) used by the get_station_info tool.
    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)) ); }
  • Type definition for the output response (StationInfoResponse) from the NS API.
    export interface StationInfoResponse { payload: Station[]; }
  • src/index.ts:149-174 (registration)
    Registration of the get_station_info tool in the ListToolsRequestHandler, including schema and description (stdio server).
    { 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'] } },
  • src/index.ts:331-340 (registration)
    Dispatch handler case in CallToolRequestHandler that validates arguments and calls the NSApiService.getStationInfo (stdio server).
    case 'get_station_info': { if (!isValidStationInfoArgs(rawArgs)) { throw ResponseFormatter.createMcpError( ErrorCode.InvalidParams, 'Invalid arguments for get_station_info' ); } const data = await this.nsApiService.getStationInfo(rawArgs); return ResponseFormatter.formatSuccess(data); }

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