Skip to main content
Glama

get_regional_conditions

Retrieve road conditions and events for British Columbia regions to plan trips. Filter by event types like construction, incidents, or weather conditions.

Instructions

Get road conditions and events for a specific BC region. Useful for planning trips within a geographic area.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionYesBC region name. Options: Lower Mainland, Vancouver Island, Thompson Okanagan, Kootenay Rockies, Cariboo, Northern BC
eventTypeNoFilter by event type (optional)
limitNoMaximum number of events to return (default: 50, max: 500)

Implementation Reference

  • The handler function executing the tool logic: validates region, fetches active events from DriveBC API filtered by region and optional type/limit, formats and returns the list or error messages.
    export async function handleRegionalConditions(args: {
      region: string;
      eventType?: EventType;
      limit?: number;
    }): Promise<string> {
      try {
        const regionId = findRegionId(args.region);
    
        if (!regionId) {
          const validRegions = Object.keys(BC_REGIONS).join(', ');
          return `Invalid region "${args.region}". Valid regions are: ${validRegions}`;
        }
    
        const params: EventQueryParams = {
          status: 'ACTIVE',
          area_id: regionId,
          limit: args.limit ?? 50,
        };
    
        if (args.eventType) {
          params.event_type = args.eventType;
        }
    
        const events = await getEvents(params);
    
        if (events.length === 0) {
          return `No current events found for ${args.region} region.`;
        }
    
        return `Regional Conditions for ${args.region}\n\n${formatEventList(events)}`;
      } catch (error) {
        if (error instanceof Error) {
          return `Error fetching regional conditions: ${error.message}`;
        }
        return 'Error fetching regional conditions: Unknown error';
      }
    }
  • Tool definition with name, description, and input schema for parameters: region (required), eventType (optional enum), limit (optional 1-500).
    export const regionalConditionsTool = {
      name: 'get_regional_conditions',
      description: 'Get road conditions and events for a specific BC region. Useful for planning trips within a geographic area.',
      inputSchema: {
        type: 'object' as const,
        properties: {
          region: {
            type: 'string',
            description: `BC region name. Options: ${Object.keys(BC_REGIONS).join(', ')}`,
          },
          eventType: {
            type: 'string',
            enum: ['CONSTRUCTION', 'INCIDENT', 'WEATHER_CONDITION', 'ROAD_CONDITION', 'SPECIAL_EVENT'],
            description: 'Filter by event type (optional)',
          },
          limit: {
            type: 'number',
            description: 'Maximum number of events to return (default: 50, max: 500)',
            minimum: 1,
            maximum: 500,
          },
        },
        required: ['region'],
      },
    };
  • src/index.ts:39-48 (registration)
    Registers the get_regional_conditions tool (via regionalConditionsTool) in the MCP server's list of available tools.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          highwayConditionsTool,
          regionalConditionsTool,
          roadClosuresTool,
          weatherAlertsTool,
        ],
      };
    });
  • src/index.ts:56-75 (registration)
    Dispatches calls to the get_regional_conditions tool by invoking handleRegionalConditions in the MCP CallToolRequestHandler switch statement.
    switch (name) {
      case 'get_highway_conditions':
        result = await handleHighwayConditions(args as any);
        break;
    
      case 'get_regional_conditions':
        result = await handleRegionalConditions(args as any);
        break;
    
      case 'get_road_closures':
        result = await handleRoadClosures(args as any);
        break;
    
      case 'get_weather_alerts':
        result = await handleWeatherAlerts(args as any);
        break;
    
      default:
        throw new Error(`Unknown tool: ${name}`);
    }

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