Skip to main content
Glama

get_weather_forecast

Retrieve weather forecasts for any location with hourly or daily data including temperature, humidity, wind, and precipitation probability up to 16 days ahead.

Instructions

Get weather forecast for a location, up to 16 days ahead. Returns hourly or daily forecast data including temperature, humidity, wind, and precipitation probability. Source: NOAA GFS model. Note: This dataset is coming soon.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latNoLatitude
lonNoLongitude
zipNoUS 5-digit ZIP code

Implementation Reference

  • The tool "get_weather_forecast" is registered and handled directly in this block within `src/tools/weather.ts`. It takes lat/lon or zip as input, calls an API endpoint, and returns the weather forecast data.
    server.registerTool(
      "get_weather_forecast",
      {
        title: "Get Weather Forecast",
        description:
          "Get weather forecast for a location, up to 16 days ahead. Returns hourly " +
          "or daily forecast data including temperature, humidity, wind, and precipitation " +
          "probability. Source: NOAA GFS model. Note: This dataset is coming soon.",
        inputSchema: {
          lat: z.number().min(-90).max(90).optional().describe("Latitude"),
          lon: z.number().min(-180).max(180).optional().describe("Longitude"),
          zip: z.string().optional().describe("US 5-digit ZIP code"),
        },
      },
      async ({ lat, lon, zip }) => {
        if (!zip && (lat === undefined || lon === undefined)) {
          return {
            content: [
              {
                type: "text" as const,
                text: "Please provide either lat+lon or a ZIP code.",
              },
            ],
            isError: true,
          };
        }
    
        const res = await apiGet<WeatherResponse>("/api/v1/weather/forecast", {
          lat,
          lon,
          zip,
        });
    
        if (!res.ok) {
          if (res.status === 404) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: "Weather dataset is not yet available. This data source is coming soon.",
                },
              ],
            };
          }
          return {
            content: [
              {
                type: "text" as const,
                text: `API error (${res.status}): ${JSON.stringify(res.data)}`,
              },
            ],
            isError: true,
          };
        }
    
        return {
          content: [
            { type: "text" as const, text: JSON.stringify(res.data, null, 2) },
          ],
        };
      },
    );

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/carrierone/verilexdata-mcp'

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