Skip to main content
Glama

get_current_weather

Retrieve current weather conditions including temperature, humidity, wind, precipitation, and conditions using latitude/longitude coordinates or US ZIP codes from NOAA and GFS data sources.

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 handler function that executes the logic for the "get_current_weather" tool by calling the weather API.
    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 definition for the "get_current_weather" tool using Zod.
    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 the "get_current_weather" tool within the MCP server.
    server.registerTool(
      "get_current_weather",

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