Knowledge & tools

OpenWeather tool

The OpenWeather tool gives an agent weather and geo data — current conditions, a 5-day/3-hour forecast, geocoding (city ↔ coordinates), and air quality — behind a single action it picks per call. One credential: a free OpenWeather API key. It's read-only.

Default units are Kelvin. Pass units: metric (°C, m/s) or units: imperial (°F, mph) for human-readable temperatures. The schema nudges the agent to do this, but it's worth knowing.

Connect OpenWeather

  1. Sign up free at openweathermap.org.
  2. Go to My API keys (home.openweathermap.org/api_keys).
  3. Copy the default key (or generate one named "Hania") and paste it into the API Key field. Stored encrypted, never shown again.
Activation delay: brand-new keys take ~10 minutes to 2 hours to activate — a 401 right after creating one is activation lag, not a bad key.
One Call: the one_call action needs the free "One Call by Call" subscription on your OpenWeather account. The other 8 actions work on any free key.

Actions (9)

  • current_weather — current conditions for a place. Needs a location (q / zip / city id / lat+lon).
  • forecast — 5-day / 3-hour forecast. Needs a location.
  • geocode — city name → coordinates (+ matches). Needs q.
  • reverse_geocode — coordinates → place name. Needs lat, lon.
  • zip_lookup — postal code → place + coordinates. Needs zip.
  • air_pollution — current AQI + pollutants. Needs lat, lon.
  • air_pollution_forecast — 4-day hourly air quality. Needs lat, lon.
  • air_pollution_history — historical air quality. Needs lat, lon, start, end.
  • one_call — current + minutely + hourly + daily + alerts in one call (needs the "One Call by Call" subscription). Needs lat, lon.

How location works

For current_weather / forecast, give a place one way: a city name in q (e.g. London or London,GB), a zip (E14,GB), a city id, or lat+lon. Air quality and one_call require coordinates — so for a city name the agent geocodes first, then queries; the tool makes this a natural two-step.

Field reference

  • unitsmetric or imperial (default standard = Kelvin).
  • lang — language for weather descriptions (en, fr, es, de…).
  • q (geocode) — city name, optional US state, optional country code — Paris,TX,US.
  • limit — geocoding: how many matches to return (up to 5).
  • zip — postal code + country, 90210,US.
  • start / end — air-quality history window, as Unix seconds (UTC).
  • excludeone_call: parts to drop — any of current,minutely,hourly,daily,alerts.

Common recipes

  • Current weather for a citycurrent_weather with q and units: metric.
  • Will it rain tomorrow?forecast for the location and read the next day's 3-hour blocks.
  • Air quality near megeocode the city → air_pollution with the returned lat/lon.
  • Rich forecast with alertsone_call (with the subscription enabled).

Errors & limits

OpenWeather returns real HTTP status codes plus a {cod, message} body (surfaced verbatim):

  • 401 — key not active yet (wait for activation), or one_call needs the subscription.
  • 404 — "city not found"; refine q (add a country code) or geocode first.
  • 429 — rate limit (free plan is 60 calls/min).
  • 400 — bad parameters.

Classification & lifecycle

This tool is read-only — no writes, nothing destructive, nothing to confirm. It's post-call-hook eligible (runs outside the LLM turn).