Weather threshold check
POST /api/weather-thresholdsCheck the hourly forecast against your own rules: for each rule (a variable, a comparison, a value) get whether it is met in the next 1-168 hours, the first and last hour it is met, how many hours, and the highest or lowest value. Send POST /api/weather-thresholds with the required field rules and pay $0.003 per call over x402 or MPP (there is no free tier). It returns a JSON object with lat, lon, place, timezone, period and 3 more.
Up to 8 rules over temperature, feels-like, humidity, precipitation and its probability, snowfall, wind, gusts, cloud cover and UV, for example frost (temperature < 0) or gusts > 60. Any place by coordinates or name. 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 |
hours | number | no | Forecast hours to check, 1-168 (default 72) |
units | string | no | celsius (default; wind in km/h) or fahrenheit (wind in mph); precipitation mm, snowfall cm |
rules | array of object | yes | 1-8 rules, each { variable, op, value } |
Example request
curl -i -X POST https://agent402.tools/api/weather-thresholds \
-H "Content-Type: application/json" \
-d '{"place":"Denver","hours":72,"rules":[{"variable":"temperature","op":"<","value":0},{"variable":"wind_gusts","op":">","value":60}]}'Without payment this returns HTTP 402 Payment Required with the exact price for weather-thresholds; any x402 v2 or MPP client pays it and retries.
Example response
{
"lat": 39.73915,
"lon": -104.9847,
"place": {
"query": "Denver",
"name": "Denver",
"country": "United States",
"countryCode": "US",
"region": "Colorado",
"timezone": "America/Denver",
"lat": 39.73915,
"lon": -104.9847,
"source": "geocoding-api.open-meteo.com (GeoNames, CC BY 4.0)",
"credit": "Place data from GeoNames (CC BY 4.0)."
},
"timezone": "America/Denver",
"period": {
"from": "2026-11-17T09:00",
"to": "2026-11-20T08:00",
"hours": 72
},
"rules": [
{
"variable": "temperature",
"op": "<",
"value": 0,
"unit": "°C",
"met": true,
"firstAt": "2026-11-18T02:00",
"lastAt": "2026-11-20T07:00",
"hoursMet": 14,
"hoursRead": 72,
"lowest": {
"value": -4.1,
"at": "2026-11-19T06:00"
}
},
{
"variable": "wind_gusts",
"op": ">",
"value": 60,
"unit": "km/h",
"met": false,
"firstAt": null,
"lastAt": null,
"hoursMet": 0,
"hoursRead": 72,
"highest": {
"value": 38.9,
"at": "2026-11-18T14:00"
}
}
],
"anyMet": true,
"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 | 39.73915 |
lon | number | yes | -104.9847 |
place | object | yes | 10 fields: query, name, country, countryCode, region, timezone and 4 more |
timezone | string | yes | America/Denver |
period | object | yes | 3 fields: from, to, hours |
rules | array of objects | yes | 2 items in the example |
anyMet | boolean | yes | true |
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-thresholds",
"params": {
"place": "Denver",
"hours": 72,
"rules": [
{
"variable": "temperature",
"op": "<",
"value": 0
},
{
"variable": "wind_gusts",
"op": ">",
"value": 60
}
]
}
}The hosted connector at https://agent402.tools/mcp needs a payment for weather-thresholds; 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
rulesis required. An input the tool rejects returns an HTTP 4xx whose body carrieserror,tool,expected,requiredandexample, so the caller can correct it.- 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
GETorHEADto /api/weather-thresholds returns the same 402 quote, so the price can be read without a body. - 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.003" }); // 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-thresholds", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"place": "Denver",
"hours": 72,
"rules": [
{
"variable": "temperature",
"op": "<",
"value": 0
},
{
"variable": "wind_gusts",
"op": ">",
"value": 60
}
]
}),
});Related tools
Current weather (global)
Current weather conditions for any location on Earth: temperature, feels-like, humidity, wind speed/direction/gusts.
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 window finder
Find the hours in the next 1-16 days that meet your limits for an outdoor plan: rain chance, rain amount, wind, gusts.