Skip to main content
Glama

Get Weather History

get_weather_history

Retrieve historical weather data for any US location by ZIP code or coordinates. Get hourly observations of temperature, humidity, wind, precipitation, and pressure from NOAA ISD.

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 async handler function for the get_weather_history tool. Validates location input (lat+lon or zip), calls the API endpoint /api/v1/weather/history, and returns weather observations with a summary count.
      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)}`,
            },
          ],
        };
      },
    );
  • Input schema for get_weather_history tool: optional zip, lat, lon, and required date_from and date_to (YYYY-MM-DD format).
    {
      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."),
      },
    },
  • Registration of the tool named 'get_weather_history' via server.registerTool() within the registerWeatherTools function.
    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."),
        },
      },
      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)}`,
            },
          ],
        };
      },
    );
  • src/index.ts:15-15 (registration)
    Import of registerWeatherTools from weather.ts, which is called on line 42 to register all weather tools including get_weather_history.
    import { registerWeatherTools } from "./tools/weather.js";
  • The apiGet helper function used by the handler to make HTTP GET requests to the Verilex API.
    export async function apiGet<T = unknown>(
      path: string,
      params?: Record<string, string | number | undefined>,
    ): Promise<ApiResponse<T>> {
      const url = buildUrl(path, params);
    
      const headers: Record<string, string> = {
        Accept: "application/json",
        "User-Agent": "verilex-mcp-server/0.1.0",
      };
    
      // Forward x402 payment token if present in env (for paid endpoints)
      const paymentToken = process.env.VERILEX_PAYMENT_TOKEN;
      if (paymentToken) {
        headers["X-Payment-Token"] = paymentToken;
      }
    
      const res = await fetch(url, { headers });
      const data = (await res.json()) as T;
    
      const stale = res.headers.get("X-Data-Stale");
      const lastUpdated = res.headers.get("X-Data-Last-Updated");
      const ageSeconds = res.headers.get("X-Data-Age-Seconds");
    
      return {
        ok: res.ok,
        status: res.status,
        data,
        stale: stale === "true",
        lastUpdated: lastUpdated ?? undefined,
        ageSeconds: ageSeconds ? Number(ageSeconds) : undefined,
      };
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full responsibility. It discloses the data source (NOAA ISD) and return format (hourly observations), but does not mention authentication, rate limits, or whether zip/lat/lon are all required or optional. The 'coming soon' note provides partial transparency about availability.

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

Conciseness5/5

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

The description is two sentences plus a note, front-loaded with core purpose and return fields. Every part is informative and unnecessary words are avoided.

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?

While the description covers return data and source, it lacks details on parameter combinations (e.g., location flexibility) and potential constraints. The 'coming soon' note is important for context but does not fully compensate for missing output schema or parameter behavior.

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?

Schema description coverage is 100%, so baseline is 3. The description does not add extra meaning to parameters, such as explaining the relationship between zip, lat, and lon (e.g., whether any one is sufficient or all required).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it retrieves historical weather data and lists the returned data fields (hourly observations of temperature, humidity, wind, precipitation, pressure). It distinguishes from sibling tools like get_current_weather and get_weather_forecast by specifying 'historical' and 'date range'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for past weather data but does not explicitly compare to siblings or state when-not to use. It includes a note 'coming soon' which may indicate current unavailability, but lacks clear guidance on alternatives.

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

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