Skip to main content
Glama

get_weather_history

Retrieve historical weather data for analysis by accessing hourly temperature, humidity, wind, precipitation, and pressure records from NOAA ISD for specific locations and date ranges.

Instructions

Get historical weather data for a location and date range. Returns hourly observations including temperature, humidity, wind, precipitation, and pressure. Source: NOAA ISD. Note: This dataset is coming soon.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
zipNoUS 5-digit ZIP code
latNoLatitude
lonNoLongitude
date_fromYesStart date (YYYY-MM-DD). Required.
date_toYesEnd date (YYYY-MM-DD). Required.

Implementation Reference

  • The asynchronous handler function for get_weather_history, which validates input and calls the /api/v1/weather/history endpoint.
      async ({ zip, lat, lon, date_from, date_to }) => {
        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/history", {
          zip,
          lat,
          lon,
          date_from,
          date_to,
        });
    
        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,
          };
        }
    
        const data = res.data;
        const count = Array.isArray(data.data) ? data.data.length : 1;
        const summary = `Retrieved ${count} weather observation(s).`;
    
        return {
          content: [
            {
              type: "text" as const,
              text: `${summary}\n\n${JSON.stringify(data, null, 2)}`,
            },
          ],
        };
      },
    );
  • The registration block for get_weather_history, including the input schema definitions.
    server.registerTool(
      "get_weather_history",
      {
        title: "Get Weather History",
        description:
          "Get historical weather data for a location and date range. Returns hourly " +
          "observations including temperature, humidity, wind, precipitation, and " +
          "pressure. Source: NOAA ISD. Note: This dataset is coming soon.",
        inputSchema: {
          zip: z.string().optional().describe("US 5-digit ZIP code"),
          lat: z.number().min(-90).max(90).optional().describe("Latitude"),
          lon: z.number().min(-180).max(180).optional().describe("Longitude"),
          date_from: z
            .string()
            .describe("Start date (YYYY-MM-DD). Required."),
          date_to: z
            .string()
            .describe("End date (YYYY-MM-DD). Required."),
        },
      },

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