Skip to main content
Glama

get_weather_alerts

Retrieve active weather alerts, road condition warnings, and incidents for British Columbia highways. Filter by region, alert type, or severity to monitor winter conditions, avalanche warnings, fog advisories, and weather-related incidents.

Instructions

Get active weather alerts, incidents, and road condition warnings across BC. Includes winter conditions, avalanche warnings, fog advisories, and weather-related incidents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionNoFilter by BC region (optional)
alertTypeNoType of alert to retrieve (default: all weather-related)
severityMinimumNoMinimum severity level (default: MINOR)

Implementation Reference

  • The main handler function that fetches weather events using getEvents, filters by region, type, severity, and weather-related keywords, sorts by severity, and formats the output.
    export async function handleWeatherAlerts(args: {
      region?: string;
      alertType?: EventType;
      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.alertType) {
          params.event_type = args.alertType;
        }
    
        const events = await getEvents(params);
    
        let filteredEvents = events;
        if (!args.alertType) {
          filteredEvents = events.filter(isWeatherRelated);
        }
    
        const severityOrder = { MAJOR: 0, MODERATE: 1, MINOR: 2, UNKNOWN: 3 };
        const minimumSeverity = args.severityMinimum ?? 'MINOR';
        const minLevel = severityOrder[minimumSeverity];
    
        filteredEvents = filteredEvents.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.alertType) filters.push(`type: ${args.alertType}`);
          const filterStr = filters.length > 0 ? ` (${filters.join(', ')})` : '';
          return `No weather alerts found${filterStr}.`;
        }
    
        const lines: string[] = [];
        lines.push(`Found ${sortedEvents.length} weather alert(s):\n`);
    
        sortedEvents.forEach((event, index) => {
          lines.push(`${index + 1}. ${formatWeatherAlert(event)}`);
          lines.push('');
        });
    
        return lines.join('\n');
      } catch (error) {
        if (error instanceof Error) {
          return `Error fetching weather alerts: ${error.message}`;
        }
        return 'Error fetching weather alerts: Unknown error';
      }
    }
  • The tool definition including name, description, and input schema for validation.
    export const weatherAlertsTool = {
      name: 'get_weather_alerts',
      description: 'Get active weather alerts, incidents, and road condition warnings across BC. Includes winter conditions, avalanche warnings, fog advisories, and weather-related incidents.',
      inputSchema: {
        type: 'object' as const,
        properties: {
          region: {
            type: 'string',
            description: 'Filter by BC region (optional)',
          },
          alertType: {
            type: 'string',
            enum: ['WEATHER_CONDITION', 'ROAD_CONDITION', 'INCIDENT'],
            description: 'Type of alert to retrieve (default: all weather-related)',
          },
          severityMinimum: {
            type: 'string',
            enum: ['MINOR', 'MODERATE', 'MAJOR'],
            description: 'Minimum severity level (default: MINOR)',
          },
        },
        required: [],
      },
    };
  • src/index.ts:39-48 (registration)
    Registration of the tool in the ListToolsRequest handler, making it discoverable.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          highwayConditionsTool,
          regionalConditionsTool,
          roadClosuresTool,
          weatherAlertsTool,
        ],
      };
    });
  • src/index.ts:69-72 (registration)
    Dispatch registration in the CallToolRequest switch statement, invoking the handler.
    case 'get_weather_alerts':
      result = await handleWeatherAlerts(args as any);
      break;
  • Helper function to filter events that are weather-related by type or keywords.
    function isWeatherRelated(event: Event): boolean {
      const weatherKeywords = [
        'weather',
        'snow',
        'ice',
        'avalanche',
        'fog',
        'rain',
        'wind',
        'storm',
        'winter',
        'slippery',
        'visibility',
      ];
    
      const weatherTypes: EventType[] = ['WEATHER_CONDITION', 'ROAD_CONDITION'];
    
      if (weatherTypes.includes(event.event_type)) {
        return true;
      }
    
      const textToCheck = `${event.headline} ${event.description || ''}`.toLowerCase();
      return weatherKeywords.some(keyword => textToCheck.includes(keyword));
    }
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 describes what the tool retrieves (e.g., 'active weather alerts, incidents, and road condition warnings') but lacks details on behavioral traits such as rate limits, authentication needs, data freshness, or response format. For a tool with no annotations, this is a significant gap, as it doesn't inform the agent about operational constraints or expected behavior beyond the basic output.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, stating the core purpose in the first sentence and adding examples in the second. It avoids unnecessary details and wastes no words, making it efficient for an agent to parse. However, it could be slightly improved by structuring usage hints, but it's already well-sized for its content.

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 complexity (3 parameters, no annotations, no output schema), the description is moderately complete. It covers the purpose and scope but lacks output details, behavioral context, and sibling differentiation. Without an output schema, the agent must infer return values, and the description doesn't address this gap. It's adequate for a basic read operation but has clear omissions 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, with clear parameter descriptions and enums. The description adds minimal value beyond the schema, as it doesn't explain parameter interactions, defaults (e.g., 'default: all weather-related' for alertType is only in the schema), or usage examples. With high schema coverage, the baseline score is 3, as the description doesn't compensate with additional semantic insights.

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: 'Get active weather alerts, incidents, and road condition warnings across BC.' It specifies the verb ('Get') and resources ('weather alerts, incidents, and road condition warnings'), and includes examples like 'winter conditions, avalanche warnings, fog advisories.' However, it doesn't explicitly differentiate from sibling tools like 'get_highway_conditions' or 'get_road_closures,' which likely overlap in scope, preventing a score of 5.

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 its siblings (e.g., 'get_highway_conditions,' 'get_regional_conditions,' 'get_road_closures'). It mentions the scope ('across BC') and types of alerts, but lacks explicit when-to-use or when-not-to-use instructions, alternatives, or prerequisites, leaving the agent to infer usage context without clear direction.

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