get_disruptions
Retrieve current and planned Dutch railway disruptions including maintenance work, alternative transport options, and travel impact details.
Instructions
Get comprehensive information about current and planned disruptions on the Dutch railway network. Returns details about maintenance work, unexpected disruptions, alternative transport options, impact on travel times, and relevant advice. Can filter for active disruptions and specific disruption types.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| isActive | No | Filter to only return active disruptions | |
| type | No | Type of disruptions to return (e.g., MAINTENANCE, DISRUPTION) |
Implementation Reference
- src/services/NSApiService.ts:49-61 (handler)Core implementation of the get_disruptions tool. Fetches disruption data from the NS API endpoint using axios, applies optional filters for isActive and type, and returns the Disruption[] array.async getDisruptions(args: GetDisruptionsArgs): Promise<Disruption[]> { this.ensureApiKeyConfigured(); const response = await this.axiosInstance.get<Disruption[]>( NSApiService.ENDPOINTS.DISRUPTIONS, { params: { isActive: args.isActive, type: args.type, }, } ); return response.data; }
- src/types.ts:131-159 (schema)Input schema definition (GetDisruptionsArgs interface) and validation function (isValidDisruptionsArgs) used by the tool handler.export interface GetDisruptionsArgs { isActive?: boolean; // Filter for active disruptions only type?: DisruptionType; // Type of disruption to filter for } /** * Type guard for disruption arguments */ export function isValidDisruptionsArgs(args: unknown): args is GetDisruptionsArgs { if (!args || typeof args !== "object") { return false; } const typedArgs = args as Record<string, unknown>; // Check isActive: should be undefined or boolean if (typedArgs.isActive !== undefined && typeof typedArgs.isActive !== "boolean") { return false; } // Check type: should be undefined or one of the allowed values if (typedArgs.type !== undefined && (typeof typedArgs.type !== "string" || !["MAINTENANCE", "DISRUPTION"].includes(typedArgs.type))) { return false; } return true; }
- src/index.ts:287-424 (registration)Tool registration and dispatching logic in the STDIO MCP server (src/index.ts). Validates args and delegates to NSApiService.getDisruptions.case 'get_disruptions': { if (!isValidDisruptionsArgs(rawArgs)) { throw ResponseFormatter.createMcpError( ErrorCode.InvalidParams, 'Invalid arguments for get_disruptions' ); } const data = await this.nsApiService.getDisruptions(rawArgs); return ResponseFormatter.formatSuccess(data); } case 'get_travel_advice': { if (!isValidTravelAdviceArgs(rawArgs)) { throw ResponseFormatter.createMcpError( ErrorCode.InvalidParams, 'Invalid arguments for get_travel_advice' ); } const data = await this.nsApiService.getTravelAdvice(rawArgs); return ResponseFormatter.formatSuccess(data); } case 'get_departures': { if (!isValidDeparturesArgs(rawArgs)) { throw ResponseFormatter.createMcpError( ErrorCode.InvalidParams, 'Invalid arguments for get_departures' ); } const data = await this.nsApiService.getDepartures(rawArgs); return ResponseFormatter.formatSuccess(data); } case 'get_ovfiets': { if (!isValidOVFietsArgs(rawArgs)) { throw ResponseFormatter.createMcpError( ErrorCode.InvalidParams, 'Invalid arguments for get_ovfiets' ); } const data = await this.nsApiService.getOVFiets(rawArgs); return ResponseFormatter.formatSuccess(data); } 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); } case 'get_current_time_in_rfc3339': { const now = new Date(); return ResponseFormatter.formatSuccess({ datetime: now.toISOString(), timezone: 'Europe/Amsterdam' }); } 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); } case 'get_prices': { if (!isValidPricesArgs(rawArgs)) { throw ResponseFormatter.createMcpError( ErrorCode.InvalidParams, 'Invalid arguments for get_prices' ); } const data = await this.nsApiService.getPrices(rawArgs); return ResponseFormatter.formatSuccess(data); } default: throw ResponseFormatter.createMcpError( ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}` ); } } catch (error) { return ResponseFormatter.formatError(error); } }); } async run(): Promise<void> { const transport = new StdioServerTransport(); await this.server.connect(transport); } } const server = new NSServer(); server.run().catch(console.error);
- src/http-server.ts:415-424 (registration)Tool registration and dispatching logic in the HTTP MCP server (src/http-server.ts). Validates args and delegates to NSApiService.getDisruptions.case 'get_disruptions': { if (!isValidDisruptionsArgs(rawArgs)) { throw ResponseFormatter.createMcpError( ErrorCode.InvalidParams, 'Invalid arguments for get_disruptions' ); } const data = await this.nsApiService.getDisruptions(rawArgs); return ResponseFormatter.formatSuccess(data); }
- src/index.ts:53-69 (registration)MCP tool registration in listTools response for STDIO server, including name, description, and input schema.{ name: 'get_disruptions', description: 'Get comprehensive information about current and planned disruptions on the Dutch railway network. Returns details about maintenance work, unexpected disruptions, alternative transport options, impact on travel times, and relevant advice. Can filter for active disruptions and specific disruption types.', inputSchema: { type: 'object', properties: { isActive: { type: 'boolean', description: 'Filter to only return active disruptions', }, type: { type: 'string', description: 'Type of disruptions to return (e.g., MAINTENANCE, DISRUPTION)', enum: ['MAINTENANCE', 'DISRUPTION'] }, }, },