Skip to main content
Glama

get_highway_conditions

Retrieve current highway conditions, incidents, and closures in British Columbia to plan safe travel routes and avoid disruptions.

Instructions

Get current conditions, incidents, and closures for a specific BC highway. Returns active events including construction, accidents, weather conditions, and road closures.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
highwayYesHighway number or name (e.g., "Highway 1", "Highway 99", "1", "99")
severityNoFilter by severity level (optional)
includeScheduledNoInclude scheduled construction/maintenance (default: true)

Implementation Reference

  • The main handler function `handleHighwayConditions` that normalizes the highway name, fetches events using `getEvents`, optionally filters by severity and scheduled events, formats the list with `formatEventList`, and handles errors.
    export async function handleHighwayConditions(args: { highway: string; severity?: 'MINOR' | 'MODERATE' | 'MAJOR' | 'UNKNOWN'; includeScheduled?: boolean; }): Promise<string> { try { const normalizedHighway = normalizeHighwayName(args.highway); const includeScheduled = args.includeScheduled ?? true; const params: EventQueryParams = { status: 'ACTIVE', road_name: normalizedHighway, }; if (args.severity) { params.severity = args.severity; } const events = await getEvents(params); let filteredEvents = events; if (!includeScheduled) { filteredEvents = events.filter(e => e.event_type !== 'CONSTRUCTION'); } if (filteredEvents.length === 0) { return `No current events found for ${normalizedHighway}.`; } return `Highway Conditions for ${normalizedHighway}\n\n${formatEventList(filteredEvents)}`; } catch (error) { if (error instanceof Error) { return `Error fetching highway conditions: ${error.message}`; } return 'Error fetching highway conditions: Unknown error'; } }
  • Tool definition object `highwayConditionsTool` containing the name, description, and input schema for parameter validation.
    export const highwayConditionsTool = { name: 'get_highway_conditions', description: 'Get current conditions, incidents, and closures for a specific BC highway. Returns active events including construction, accidents, weather conditions, and road closures.', inputSchema: { type: 'object' as const, properties: { highway: { type: 'string', description: 'Highway number or name (e.g., "Highway 1", "Highway 99", "1", "99")', }, severity: { type: 'string', enum: ['MINOR', 'MODERATE', 'MAJOR', 'UNKNOWN'], description: 'Filter by severity level (optional)', }, includeScheduled: { type: 'boolean', description: 'Include scheduled construction/maintenance (default: true)', }, }, required: ['highway'], }, };
  • src/index.ts:56-59 (registration)
    Switch case in the CallToolRequest handler that maps the tool name to the `handleHighwayConditions` execution.
    switch (name) { case 'get_highway_conditions': result = await handleHighwayConditions(args as any); break;
  • src/index.ts:39-48 (registration)
    ListToolsRequest handler that includes `highwayConditionsTool` in the list of available tools.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ highwayConditionsTool, regionalConditionsTool, roadClosuresTool, weatherAlertsTool, ], }; });
  • src/index.ts:11-13 (registration)
    Import of the tool schema and handler from the tools file.
    highwayConditionsTool, handleHighwayConditions, } from './tools/highway-conditions.js';

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