Skip to main content
Glama

get_weather_alerts

Retrieve real-time weather alerts for any location using One Call support. Part of the Multi-MCPs server, this tool integrates multiple third-party APIs for unified access to essential services.

Instructions

Get weather alerts for a location (requires One Call support)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationYes

Implementation Reference

  • The handler function for the 'get_weather_alerts' tool. It checks for API key configuration, validates the location input, and delegates to the OpenWeatherClient's alertsByLocation method.
    async get_weather_alerts(args: Record<string, unknown>) { if (!cfg.openWeatherApiKey) throw new Error("OPENWEATHER_API_KEY is not configured"); const location = String(args.location || ""); if (!location) throw new Error("location is required"); return client.alertsByLocation(location); },
  • The tool schema definition including name, description, and input schema requiring a 'location' string.
    { name: "get_weather_alerts", description: "Get weather alerts for a location (requires One Call support)", inputSchema: { type: "object", properties: { location: { type: "string" }, }, required: ["location"], }, },
  • Registration of all tools including 'get_weather_alerts' via registerOpenWeather() call, which provides tools and handlers to the MCP server.
    const registrations: ToolRegistration[] = [ registerOpenWeather(), registerGoogleMaps(), registerNewsApi(), registerGitHub(), registerNotion(), registerTrello(), registerSpotify(), registerTwilio(), registerUnsplash(), registerCoinGecko(), ];
  • Helper method in OpenWeatherClient that geocodes the location and fetches weather alerts using OpenWeatherMap's One Call API.
    async alertsByLocation(location: string) { const geo = await this.geocodeCity(location); const first = Array.isArray(geo) && geo.length > 0 ? geo[0] : undefined; if (!first) return { alerts: [] }; const { lat, lon } = first as { lat: number; lon: number }; // One Call 3.0 - alerts field appears if available in your plan const data = await this.request("/data/3.0/onecall", { query: { lat, lon, appid: this.apiKey, units: "metric" }, }); return (data as any).alerts || []; }

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/TaylorChen/muti-mcps'

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