WMO weather code lookup
GET /api/wmo-weather-codeTurn a WMO weather interpretation code (the weatherCode field of a forecast, 0-99) into its text label and a category: clear, cloudy, fog, drizzle, rain, snow or thunderstorm, with flags for freezing and for precipitation. Send GET /api/wmo-weather-code with no required fields (1 optional) and pay $0.001 per call over x402 or MPP, or call it free by solving a proof-of-work challenge. It returns a JSON object with found, code, condition, category, freezing and 1 more.
With no code, returns the whole table.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
code | number | no | WMO weather code, 0-99; leave out for the whole table |
Example request
curl -i "https://agent402.tools/api/wmo-weather-code?code=63"
Without payment this returns HTTP 402 Payment Required with the exact price for wmo-weather-code; any x402 v2 or MPP client pays it and retries.
Example response
{
"found": true,
"code": 63,
"condition": "Moderate rain",
"category": "rain",
"freezing": false,
"precipitation": true
}| Field | Type | Always present | In the example |
|---|---|---|---|
found | boolean | yes | true |
code | number | yes | 63 |
condition | string | yes | Moderate rain |
category | string | yes | rain |
freezing | boolean | yes | false |
precipitation | boolean | yes | true |
From an MCP client
catalog.call {
"slug": "wmo-weather-code",
"params": {
"code": 63
}
}On the hosted connector at https://agent402.tools/mcp, catalog.call runs wmo-weather-code free (rate-limited, no wallet). 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.
- Free tier: no outbound network call leaves the server for this tool, so proof-of-work (16 leading zero bits of sha256) pays for it.
- A
POSTwith a JSON body to /api/wmo-weather-code 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.001" }); // 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/wmo-weather-code?code=63");No wallet? Pay with compute
Fetch a challenge, solve the sha256 puzzle (16 leading zero bits, a fraction of a second of CPU), and resend with the X-Pow-Solution header:
import { createHash } from "node:crypto";
const lz = (b) => { let t = 0; for (const x of b) { if (!x) { t += 8; continue; } t += Math.clz32(x) - 24; break; } return t; };
const c = await (await fetch("https://agent402.tools/api/pow/challenge?slug=wmo-weather-code")).json();
let n = 0;
while (lz(createHash("sha256").update(c.challenge + ":" + n).digest()) < c.difficulty) n++;
await fetch("https://agent402.tools/api/wmo-weather-code?code=63", { method: "GET", headers: { "X-Pow-Solution": c.token + ":" + n } });Related tools
Barcode product lookup
Look up a product by its UPC/EAN barcode number via Open Food Facts (open data): name, brand, category, quantity.
EDGAR company lookup (ticker → CIK)
Resolve a US stock ticker (e.g.
Heat index and wind chill calculator
Heat index, wind chill, humidex, dew point and wet-bulb temperature from the temperature, humidity and wind you supply.
Air quality (global)
Air quality index and current pollutant concentrations for any location: US AQI, PM2.5, PM10, ozone, NO2, SO2, CO.
US weather alerts
Active National Weather Service alerts for a US state as clean JSON: event, severity, headline, affected areas.
Current weather (global)
Current weather conditions for any location on Earth: temperature, feels-like, humidity, wind speed/direction/gusts.