Skip to main content
Glama
TaylorChen

Multi-MCPs

by TaylorChen

get_weather_alerts

Retrieve weather alerts for any location to stay informed about severe conditions and safety warnings through the Multi-MCPs server.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationYes

Implementation Reference

  • The main handler function for the 'get_weather_alerts' tool. It checks for API key configuration, extracts and validates the location parameter, 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);
    },
  • Input schema definition for the 'get_weather_alerts' tool, specifying that a 'location' string is required.
    inputSchema: {
      type: "object",
      properties: {
        location: { type: "string" },
      },
      required: ["location"],
    },
  • Tool registration entry in the OpenWeather module's tools array, defining name, description, and schema.
    {
      name: "get_weather_alerts",
      description: "Get weather alerts for a location (requires One Call support)",
      inputSchema: {
        type: "object",
        properties: {
          location: { type: "string" },
        },
        required: ["location"],
      },
    },
  • Global tool registration in registerAllTools, which includes registerOpenWeather() thereby registering the 'get_weather_alerts' tool among others.
    const registrations: ToolRegistration[] = [
      registerOpenWeather(),
      registerGoogleMaps(),
      registerNewsApi(),
      registerGitHub(),
      registerNotion(),
      registerTrello(),
      registerSpotify(),
      registerTwilio(),
      registerUnsplash(),
      registerCoinGecko(),
    ];
  • Helper method in OpenWeatherClient that geocodes the location, fetches One Call API data, and extracts weather alerts.
    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