Skip to main content
Glama

get_road_closures

Retrieve current road closures and restrictions across British Columbia, with options to filter by region, highway, or severity level.

Instructions

List all current road closures and major restrictions across BC or filtered by region/highway. Includes full closures, lane closures, and significant restrictions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionNoFilter by BC region (optional)
highwayNoFilter by specific highway (optional)
severityMinimumNoMinimum severity to include (default: MODERATE)

Implementation Reference

  • The handler function that implements the core logic: queries events API with filters, identifies closure-related events using keywords and severity, applies minimum severity filter, sorts by severity, and formats a numbered list of closures.
    export async function handleRoadClosures(args: {
      region?: string;
      highway?: string;
      severityMinimum?: 'MINOR' | 'MODERATE' | 'MAJOR';
    }): Promise<string> {
      try {
        const params: EventQueryParams = {
          status: 'ACTIVE',
        };
    
        if (args.region) {
          const regionId = findRegionId(args.region);
          if (!regionId) {
            return `Invalid region "${args.region}". Please use a valid BC region name.`;
          }
          params.area_id = regionId;
        }
    
        if (args.highway) {
          params.road_name = normalizeHighwayName(args.highway);
        }
    
        const events = await getEvents(params);
    
        const closureEvents = events.filter(isClosureRelated);
    
        const severityOrder = { MAJOR: 0, MODERATE: 1, MINOR: 2, UNKNOWN: 3 };
        const minimumSeverity = args.severityMinimum ?? 'MODERATE';
        const minLevel = severityOrder[minimumSeverity];
    
        const filteredEvents = closureEvents.filter(
          event => severityOrder[event.severity] <= minLevel
        );
    
        const sortedEvents = filteredEvents.sort(
          (a, b) => severityOrder[a.severity] - severityOrder[b.severity]
        );
    
        if (sortedEvents.length === 0) {
          const filters = [];
          if (args.region) filters.push(`region: ${args.region}`);
          if (args.highway) filters.push(`highway: ${normalizeHighwayName(args.highway)}`);
          const filterStr = filters.length > 0 ? ` (${filters.join(', ')})` : '';
          return `No road closures found${filterStr}.`;
        }
    
        const lines: string[] = [];
        lines.push(`Found ${sortedEvents.length} road closure(s):\n`);
    
        sortedEvents.forEach((event, index) => {
          lines.push(`${index + 1}. ${formatClosureInfo(event)}`);
          lines.push('');
        });
    
        return lines.join('\n');
      } catch (error) {
        if (error instanceof Error) {
          return `Error fetching road closures: ${error.message}`;
        }
        return 'Error fetching road closures: Unknown error';
      }
    }
  • Defines the tool metadata including name, description, and input schema for optional parameters: region, highway, severityMinimum.
    export const roadClosuresTool = {
      name: 'get_road_closures',
      description: 'List all current road closures and major restrictions across BC or filtered by region/highway. Includes full closures, lane closures, and significant restrictions.',
      inputSchema: {
        type: 'object' as const,
        properties: {
          region: {
            type: 'string',
            description: 'Filter by BC region (optional)',
          },
          highway: {
            type: 'string',
            description: 'Filter by specific highway (optional)',
          },
          severityMinimum: {
            type: 'string',
            enum: ['MINOR', 'MODERATE', 'MAJOR'],
            description: 'Minimum severity to include (default: MODERATE)',
          },
        },
        required: [],
      },
    };
  • src/index.ts:39-48 (registration)
    Registers the roadClosuresTool (imported from road-closures.ts) in the list of tools returned by ListToolsRequestHandler.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          highwayConditionsTool,
          regionalConditionsTool,
          roadClosuresTool,
          weatherAlertsTool,
        ],
      };
    });
  • src/index.ts:65-67 (registration)
    In the CallToolRequestHandler switch, maps 'get_road_closures' tool calls to the handleRoadClosures function.
    case 'get_road_closures':
      result = await handleRoadClosures(args as any);
      break;
  • Helper function to determine if an event is related to road closures by checking keywords in headline/description or MAJOR severity.
    function isClosureRelated(event: Event): boolean {
      const closureKeywords = [
        'closure',
        'closed',
        'impassable',
        'blocked',
        'restricted',
        'detour',
      ];
    
      const textToCheck = `${event.headline} ${event.description || ''}`.toLowerCase();
      return closureKeywords.some(keyword => textToCheck.includes(keyword)) ||
             event.severity === 'MAJOR';
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the types of closures included ('full closures, lane closures, and significant restrictions'), but does not cover critical aspects like data freshness, rate limits, authentication needs, or error handling, which are essential for a read operation with filtering.

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 concise and front-loaded, with two sentences that efficiently convey the tool's purpose and scope without unnecessary details. Every sentence adds value, making it easy to parse.

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

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a read operation with filtering and no annotations or output schema, the description is incomplete. It lacks information on return format, pagination, error cases, and how it differs from sibling tools, which are necessary for effective tool selection and invocation.

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 input schema has 100% description coverage, so the baseline is 3. The description adds some context by mentioning filtering by 'region/highway' and including 'severity' implicitly, but it does not provide additional semantic details beyond what the schema already documents, such as examples or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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: 'List all current road closures and major restrictions across BC or filtered by region/highway.' It specifies the verb ('List'), resource ('road closures and major restrictions'), and scope ('across BC'), but does not explicitly differentiate it from sibling tools like 'get_highway_conditions' or 'get_regional_conditions', which likely overlap in functionality.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It mentions filtering by region or highway, but does not specify when to choose this over sibling tools such as 'get_highway_conditions' or 'get_regional_conditions', leaving the agent without clear usage context.

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/infil00p/DriveBC_MCP'

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