Skip to main content
Glama

get_future_weather

Retrieve 3-hourly weather forecasts for dates 14 to 300 days ahead. Provide location details and a future date to access long-range weather predictions.

Instructions

Get future weather forecast for a date between 14 and 300 days from today. Returns 3-hourly data. Available on Pro+ plan and above.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYesLocation query — city name, lat/lon, zip, postcode, IATA, or IP.
dtYesFuture date in yyyy-MM-dd format. Must be between 14 and 300 days from today.

Implementation Reference

  • The handler implementation for the "get_future_weather" tool, which calls the "/future.json" WeatherAPI endpoint.
    case "get_future_weather": {
      const { q, dt } = args as { q: string; dt: string };
      result = await weatherRequest("/future.json", { q, dt });
      break;
    }
  • The tool registration and input schema definition for "get_future_weather".
      name: "get_future_weather",
      description:
        "Get future weather forecast for a date between 14 and 300 days from today. Returns 3-hourly data. Available on Pro+ plan and above.",
      inputSchema: {
        type: "object",
        properties: {
          q: {
            type: "string",
            description: "Location query — city name, lat/lon, zip, postcode, IATA, or IP.",
          },
          dt: {
            type: "string",
            description:
              "Future date in yyyy-MM-dd format. Must be between 14 and 300 days from today.",
          },
        },
        required: ["q", "dt"],
      },
    },
  • Helper function used by "get_future_weather" and other tools to perform authenticated requests to the WeatherAPI.
    async function weatherRequest(
      endpoint: string,
      params: Record<string, string | number>
    ): Promise<unknown> {
      const searchParams = new URLSearchParams({ key: API_KEY! });
      for (const [k, v] of Object.entries(params)) {
        searchParams.set(k, String(v));
      }
      const url = `${BASE_URL}${endpoint}?${searchParams.toString()}`;
      const res = await fetch(url);
      const data = await res.json();
      if (!res.ok) {
        const err = data as { error?: { code: number; message: string } };
        throw new McpError(
          ErrorCode.InternalError,
          `WeatherAPI error ${err.error?.code}: ${err.error?.message ?? res.statusText}`
        );
      }
      return data;
    }

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/weatherapicom/weatherapi-mcp'

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