Skip to content

Weather threshold check

$0.003 per callUSDC via x402POST /api/weather-thresholds

Check 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).

Category: Live public dataTags: weather forecast threshold frost wind alert

Try in playground →

Parameters

NameTypeRequiredDescription
latnumbernoLatitude, -90 to 90 (with lon; wins over place)
lonnumbernoLongitude, -180 to 180 (with lat)
placestringnoA 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
hoursnumbernoForecast hours to check, 1-168 (default 72)
unitsstringnocelsius (default; wind in km/h) or fahrenheit (wind in mph); precipitation mm, snowfall cm
rulesarray of objectyes1-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)"
}
FieldTypeAlways presentIn the example
latnumberyes39.73915
lonnumberyes-104.9847
placeobjectyes10 fields: query, name, country, countryCode, region, timezone and 4 more
timezonestringyesAmerica/Denver
periodobjectyes3 fields: from, to, hours
rulesarray of objectsyes2 items in the example
anyMetbooleanyestrue
sourcestringyescomputed 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

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)

$0.002GET /api/weather-current

Current weather conditions for any location on Earth: temperature, feels-like, humidity, wind speed/direction/gusts.

Daily forecast (global)

$0.002GET /api/weather-daily

7-day daily weather forecast for any location: high/low temp, precipitation sum and probability, max wind, UV index.

Weather forecast (US)

$0.001GET /api/weather-forecast

Multi-period weather forecast for a US location from api.weather.gov (NWS, public domain).

Hourly forecast (global)

$0.002GET /api/weather-hourly

48-hour hourly weather forecast for any location: temperature, precipitation probability and amount, wind, cloud cover.

Weather probability (ensemble)

$0.01GET /api/weather-probability

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

$0.004GET /api/weather-window

Find the hours in the next 1-16 days that meet your limits for an outdoor plan: rain chance, rain amount, wind, gusts.