Weather window finder
GET /api/weather-windowFind the hours in the next 1-16 days that meet your limits for an outdoor plan: rain chance, rain amount, wind, gusts, a temperature range, daylight only. Send GET /api/weather-window with no required fields (13 optional) and pay $0.004 per call over x402 or MPP (there is no free tier). It returns a JSON object with lat, lon, timezone, days, minHours and 8 more.
Returns each stretch of consecutive qualifying hours from now on, longest first, with its temperature range, rain chance and wind, or names the limit that ruled out the most hours when none fits. Any place by coordinates or name. ?place=Austin, TX&days=10&minHours=4&maxPrecipProbability=20. Weather data by Open-Meteo.com (CC BY 4.0).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
lat | number | no | Latitude, -90 to 90 (with lon; wins over place) |
lon | number | no | Longitude, -180 to 180 (with lat) |
place | string | no | A city, town or region name instead of lat/lon, for example "Paris" or "Austin, TX" (not a street address); the answer echoes the place it resolved to |
days | number | no | Forecast days to search, 1-16 (default 7) |
minHours | number | no | Shortest stretch to report, 1-24 hours (default 3) |
maxPrecipProbability | number | no | Highest rain chance allowed in any hour, 0-100 percent (default 20) |
maxPrecipitation | number | no | Highest precipitation allowed in any hour, mm (no limit by default) |
maxWind | number | no | Highest wind speed allowed, km/h (mph with units=fahrenheit) |
maxGusts | number | no | Highest wind gust allowed, km/h (mph with units=fahrenheit) |
tempMin | number | no | Lowest temperature allowed |
tempMax | number | no | Highest temperature allowed |
daylightOnly | boolean | no | Only daylight hours (default true) |
units | string | no | celsius (default; wind in km/h) or fahrenheit (wind in mph) |
Example request
curl -i "https://agent402.tools/api/weather-window?lat=30.2672&lon=-97.7431&days=10&minHours=4&maxPrecipProbability=30"
Without payment this returns HTTP 402 Payment Required with the exact price for weather-window; any x402 v2 or MPP client pays it and retries.
Example response
{
"lat": 30.2672,
"lon": -97.7431,
"timezone": "America/Chicago",
"days": 10,
"minHours": 4,
"limits": {
"maxPrecipProbability": 30,
"maxPrecipitation": null,
"maxWind": null,
"maxGusts": null,
"tempMin": null,
"tempMax": null,
"daylightOnly": true
},
"units": {
"temperature": "°C",
"wind": "km/h",
"precipitation": "mm"
},
"found": true,
"count": 9,
"windows": [
{
"start": "2026-11-18T07:00",
"end": "2026-11-18T17:00",
"hours": 11,
"tempMin": 12.4,
"tempMax": 22.9,
"maxPrecipProbability": 3,
"precipitation": 0,
"maxWind": 14.2,
"maxGusts": 27.4
}
],
"hoursSearched": 240,
"hoursMeetingLimits": 96,
"source": "computed from Open-Meteo forecast data, api.open-meteo.com (CC BY 4.0)"
}| Field | Type | Always present | In the example |
|---|---|---|---|
lat | number | yes | 30.2672 |
lon | number | yes | -97.7431 |
timezone | string | yes | America/Chicago |
days | number | yes | 10 |
minHours | number | yes | 4 |
limits | object | yes | 7 fields: maxPrecipProbability, maxPrecipitation, maxWind, maxGusts and 3 more |
units | object | yes | 3 fields: temperature, wind, precipitation |
found | boolean | yes | true |
count | number | yes | 9 |
windows | array of objects | yes | 1 item in the example |
hoursSearched | number | yes | 240 |
hoursMeetingLimits | number | yes | 96 |
source | string | yes | computed from Open-Meteo forecast data, api.open-meteo.com (CC BY 4.0) |
From an MCP client
catalog.call {
"slug": "weather-window",
"params": {
"lat": 30.2672,
"lon": -97.7431,
"days": 10,
"minHours": 4,
"maxPrecipProbability": 30
}
}The hosted connector at https://agent402.tools/mcp needs a payment for weather-window; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.13.32.
Errors and behavior
- Every field is optional. An input the tool rejects returns an HTTP 4xx whose body carries
error,tool,expected,requiredandexample. - A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement runs after the tool and only on a successful response. The exception is a Tempo push credential, a transfer the buyer sent before the call: it settles before the tool runs, so if the tool then fails the payment is recorded as a refund owed to the paying wallet.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - A
POSTwith a JSON body to /api/weather-window is served as this GET, with the body as the input. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.004" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/weather-window?lat=30.2672&lon=-97.7431&days=10&minHours=4&maxPrecipProbability=30");Related tools
Daily forecast (global)
7-day daily weather forecast for any location: high/low temp, precipitation sum and probability, max wind, UV index.
Weather forecast (US)
Multi-period weather forecast for a US location from api.weather.gov (NWS, public domain).
Hourly forecast (global)
48-hour hourly weather forecast for any location: temperature, precipitation probability and amount, wind, cloud cover.
Weather probability (ensemble)
Probability that a day's weather meets a condition, from up to 82 ensemble members (ECMWF IFS and NOAA GEFS): a high.
Weather threshold check
Check the hourly forecast against your own rules: for each rule (a variable, a comparison, a value) get whether it is.
Amortization schedule
Build the full per-period amortization schedule for a fully-amortizing loan.