Skip to main content
Glama

get_forecast

Retrieve detailed weather forecasts for 1-14 days with daily summaries, hourly breakdowns, current conditions, astronomy data, and optional alerts and air quality information for any location worldwide.

Instructions

Get weather forecast for 1 to 14 days. Returns daily summaries (max/min/avg temp, rain chance, UV, wind) and hourly breakdowns. Also returns current conditions, astronomy data (sunrise/sunset/moon phase), and optionally weather alerts and air quality.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYesLocation query — city name, lat/lon, zip, postcode, IATA, or IP.
daysNoNumber of forecast days (1–14). Default: 3.
alertsNoInclude government weather alerts. Default: no.
aqiNoInclude air quality data. Default: no.

Implementation Reference

  • The handler for 'get_forecast' extracts arguments from the request and calls 'weatherRequest'.
    case "get_forecast": {
      const { q, days = 3, alerts = "no", aqi = "no" } = args as {
        q: string;
        days?: number;
        alerts?: string;
        aqi?: string;
      };
      result = await weatherRequest("/forecast.json", { q, days, alerts, aqi });
      break;
    }
  • Registration of the 'get_forecast' tool with its description and input schema.
    name: "get_forecast",
    description:
      "Get weather forecast for 1 to 14 days. Returns daily summaries (max/min/avg temp, rain chance, UV, wind) and hourly breakdowns. Also returns current conditions, astronomy data (sunrise/sunset/moon phase), and optionally weather alerts and air quality.",
    inputSchema: {
      type: "object",
      properties: {
        q: {
          type: "string",
          description: "Location query — city name, lat/lon, zip, postcode, IATA, or IP.",
        },
        days: {
          type: "number",
          description: "Number of forecast days (1–14). Default: 3.",
        },
        alerts: {
          type: "string",
  • The 'weatherRequest' helper function that executes the actual API call for all weather tools.
    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}`
        );
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior by specifying the forecast range (1-14 days), return data types (daily summaries, hourly breakdowns, current conditions, etc.), and optional inclusions (alerts, air quality). However, it lacks details on rate limits, authentication needs, error handling, or data freshness.

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 efficiently structured in two sentences with zero waste. The first sentence states the core purpose and key details (forecast range, return data). The second adds supplementary information (optional alerts and air quality). Every element serves a clear purpose.

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?

Given the tool's moderate complexity (4 parameters, no output schema, no annotations), the description is adequate but has gaps. It covers the core functionality and data returns well, but lacks usage guidance relative to siblings and doesn't address behavioral aspects like rate limits or error handling. Without an output schema, more detail on return structure would be helpful.

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, so the schema already documents all parameters thoroughly. The description adds marginal value by implying the 'days' parameter range (1-14) and mentioning optional alerts and air quality, but doesn't provide additional syntax or format details beyond what the schema specifies. Baseline 3 is appropriate when schema does the heavy lifting.

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's purpose with specific verbs ('Get weather forecast') and resources ('daily summaries', 'hourly breakdowns', 'current conditions', etc.). It distinguishes from siblings by specifying the comprehensive forecast scope (1-14 days with multiple data types), unlike more specialized tools like get_current_weather or get_astronomy.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus its siblings. While it implies a comprehensive forecast, it doesn't explicitly state when to choose this over get_current_weather for current data only, get_future_weather for future forecasts, or get_astronomy for astronomy data alone. No exclusions or prerequisites are mentioned.

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

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