Skip to main content
Glama

get_highway_conditions

Retrieve current conditions, incidents, and closures for British Columbia highways 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 handleHighwayConditions function that executes the tool logic: normalizes highway name, fetches events via API, filters by severity and scheduled events, formats the output.
    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 including name, description, and input schema for 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:39-48 (registration)
    Registers the highwayConditionsTool in the MCP server's list of available tools.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ highwayConditionsTool, regionalConditionsTool, roadClosuresTool, weatherAlertsTool, ], }; });
  • src/index.ts:57-59 (registration)
    Dispatches tool calls named 'get_highway_conditions' to the handler function in the MCP server's call tool request handler.
    case 'get_highway_conditions': result = await handleHighwayConditions(args as any); break;

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