Skip to main content
Glama

Get Current Weather

get_current_weather

Retrieve current weather conditions for any US location. Provide latitude/longitude or ZIP code to get temperature, humidity, wind, and precipitation from the nearest station.

Instructions

Get current weather conditions for a location. Provide latitude/longitude or a US ZIP code. Returns temperature, humidity, wind, precipitation, and conditions from the nearest weather station and latest model run. Source: NOAA ISD + GFS. Note: This dataset is coming soon.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latNoLatitude (-90 to 90). Required if ZIP is not provided.
lonNoLongitude (-180 to 180). Required if ZIP is not provided.
zipNoUS 5-digit ZIP code. Alternative to lat/lon. Maps to nearest station.

Implementation Reference

  • The async handler function for 'get_current_weather'. Validates that lat+lon or zip is provided, calls the API at /api/v1/weather/current, and returns formatted text content or an error.
    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/current", {
        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_current_weather' using Zod. Defines optional lat (number -90 to 90), lon (number -180 to 180), and zip (string) parameters.
    inputSchema: {
      lat: z
        .number()
        .min(-90)
        .max(90)
        .optional()
        .describe("Latitude (-90 to 90). Required if ZIP is not provided."),
      lon: z
        .number()
        .min(-180)
        .max(180)
        .optional()
        .describe("Longitude (-180 to 180). Required if ZIP is not provided."),
      zip: z
        .string()
        .optional()
        .describe(
          "US 5-digit ZIP code. Alternative to lat/lon. Maps to nearest station.",
        ),
    },
  • Registration of 'get_current_weather' tool via server.registerTool() with its schema and handler.
    server.registerTool(
      "get_current_weather",
      {
        title: "Get Current Weather",
        description:
          "Get current weather conditions for a location. Provide latitude/longitude " +
          "or a US ZIP code. Returns temperature, humidity, wind, precipitation, and " +
          "conditions from the nearest weather station and latest model run. " +
          "Source: NOAA ISD + GFS. Note: This dataset is coming soon.",
        inputSchema: {
          lat: z
            .number()
            .min(-90)
            .max(90)
            .optional()
            .describe("Latitude (-90 to 90). Required if ZIP is not provided."),
          lon: z
            .number()
            .min(-180)
            .max(180)
            .optional()
            .describe("Longitude (-180 to 180). Required if ZIP is not provided."),
          zip: z
            .string()
            .optional()
            .describe(
              "US 5-digit ZIP code. Alternative to lat/lon. Maps to nearest station.",
            ),
        },
      },
      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/current", {
          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:42-42 (registration)
    Registration of the weather module by calling registerWeatherTools(server) in the main server setup.
    registerWeatherTools(server);
  • 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,
      };
    }
Behavior2/5

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

With no annotations, the description carries full burden. It discloses data sources and a 'coming soon' note, but does not detail limitations, update frequency, or error conditions. The note about availability may confuse agents.

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

Conciseness4/5

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

Three concise sentences cover purpose, input, output, and source. Information is front-loaded with the action and returns. The 'coming soon' note is placed last and is relevant.

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?

For a simple tool, the description covers location input and returned fields. However, it lacks explanation of parameter selection trade-offs, output format details, and the 'coming soon' status is ambiguous. Sibling tools exist but are not cross-referenced.

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 coverage is 100% with parameter descriptions. The description adds that lat/lon or ZIP can be used, but this is already implicit in the schema. No new parameter-level meaning is provided.

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 verb 'Get' and resource 'current weather conditions'. The term 'current' distinguishes it from sibling tools like get_weather_forecast and get_weather_history, and the specific fields returned are listed.

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 when current weather is needed, but does not explicitly mention alternatives or when not to use this tool. Sibling tools exist but are not referenced, leaving the agent to infer context.

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