Skip to main content
Glama
KallivdH

NS Travel Information Server

by KallivdH

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
NameRequiredDescriptionDefault
isActiveNoFilter to only return active disruptions
typeNoType of disruptions to return (e.g., MAINTENANCE, DISRUPTION)

Implementation Reference

  • 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;
    }
  • 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);
  • 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']
          },
        },
      },
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 adds some context by mentioning the tool 'can filter for active disruptions and specific disruption types,' which hints at filtering capabilities beyond the schema. However, it lacks details on rate limits, authentication needs, or what happens if no disruptions exist, leaving gaps in behavioral understanding for an agent.

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, starting with the core purpose and followed by details on returns and filtering. Every sentence earns its place by adding value, such as listing returned information and filtering options, without redundancy or unnecessary elaboration.

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

Completeness3/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 (2 parameters, no output schema, no annotations), the description is somewhat complete but has gaps. It covers the purpose and filtering but lacks details on output format, error handling, or how disruptions are structured, which could hinder an agent's ability to use it effectively without further context.

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?

The schema description coverage is 100%, so the schema already fully documents the two parameters (isActive and type). The description adds marginal value by mentioning filtering for 'active disruptions and specific disruption types,' which aligns with the schema but does not provide additional syntax or format details beyond what the schema specifies. This meets the baseline 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 comprehensive information') and resources ('current and planned disruptions on the Dutch railway network'), distinguishing it from sibling tools like get_arrivals or get_departures which focus on different railway data. It explicitly lists the types of information returned (maintenance work, unexpected disruptions, etc.), making the scope unambiguous.

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 provides clear context for when to use this tool by specifying it returns 'comprehensive information about current and planned disruptions,' implying it's for disruption-related queries rather than arrivals, departures, or other railway data. However, it does not explicitly state when not to use it or name specific alternatives among siblings, such as get_travel_advice for route planning, which could be related.

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