Skip to main content
Glama

Get Weather Forecast

get_weather_forecast

Retrieve weather forecasts up to 16 days ahead using latitude/longitude or US ZIP code. Get hourly or daily data including temperature, humidity, wind, and precipitation probability from the NOAA GFS model.

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 async handler function for the get_weather_forecast tool. Validates input (requires lat+lon or zip), calls the Verilex API at /api/v1/weather/forecast via apiGet, handles 404/error responses, and returns the forecast data as JSON.
    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) },
        ],
      };
    },
  • Input schema for get_weather_forecast: lat (optional number -90 to 90), lon (optional number -180 to 180), zip (optional string). Title and description metadata for the tool.
    {
      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"),
      },
    },
  • Registration of get_weather_forecast via server.registerTool() within the registerWeatherTools function (called from src/index.ts line 42).
    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) },
          ],
        };
      },
    );
  • src/index.ts:33-61 (registration)
    The createMcpServer function that instantiates McpServer and calls registerWeatherTools(server) on line 42, which registers the get_weather_forecast tool.
    function createMcpServer() {
      const server = new McpServer({
        name: "verilex-data",
        version: "0.3.3",
      });
    
      registerNpiTools(server);
      registerSecTools(server);
      registerPacerTools(server);
      registerWeatherTools(server);
      registerOtcTools(server);
      registerTrademarkTools(server);
      registerPatentTools(server);
      registerCompanyTools(server);
      registerCryptoTools(server);
      registerSanctionsTools(server);
      registerWhaleTools(server);
      registerLabelTools(server);
      registerHolderTools(server);
      registerDexTools(server);
      registerContractTools(server);
      registerPmTools(server);
      registerPmArbTools(server);
      registerPmResolutionTools(server);
      registerEconTools(server);
      registerPmMicroTools(server);
    
      return server;
    }
  • The apiGet helper function used by the handler to make the HTTP GET request 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,
      };
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden. It discloses the data source (NOAA GFS model) and output contents (hourly/daily data for specific variables). The note about the dataset being 'coming soon' is a key behavioral disclosure, indicating potential unavailability. However, it does not specify what happens if called now (e.g., error or empty response).

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 three sentences long, front-loaded with the core purpose, followed by output details and source/availability note. No redundant information or filler; every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description adequately covers the return data (variables, granularity). It includes source and availability warning. However, it omits units (e.g., temperature scale) and does not specify location parameter priority (e.g., if both lat/lon and zip are provided). The completeness is good but leaves minor gaps.

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?

The input schema has 100% description coverage for all three parameters (lat, lon, zip). The description adds 'for a location' but does not clarify how the parameters relate (e.g., lat/lon vs zip) or provide guidance on selection. Baseline 3 is appropriate since the schema already explains each parameter.

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 the tool retrieves weather forecasts for a location, with specific details on forecast range (up to 16 days), data granularity (hourly or daily), and included variables (temperature, humidity, wind, precipitation probability). This distinguishes it from sibling tools like get_current_weather and get_weather_history by focusing on future predictions.

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 the tool is for obtaining forecast data but does not explicitly state when to use it versus alternatives like get_current_weather or get_weather_history. The note 'This dataset is coming soon' warns about availability, but no direct comparisons or exclusions are provided.

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