Skip to content

Skill: Energy weather

$0.016 per callUSDC via x402POST /api/skill/energy-weather

Energy weather for a location in one call: heating, cooling and growing degree days for the last two weeks and the week ahead, the seasonal outlook...

Category: Skill packsTags: skill-pack workflow energy-weatherPack overview

Try in playground →

Details

Energy weather for a location in one call: heating, cooling and growing degree days for the last two weeks and the week ahead, the seasonal outlook, and 7-day solar PV and wind power forecasts. Energy weather skill pack: one x402 payment runs 4 underlying tools (degree-days, seasonal-outlook, solar-forecast, wind-power-forecast); partial-success per step. Weather data by Open-Meteo.com (CC BY 4.0). Contains modified Copernicus Climate Change Service information. Neither the European Commission nor ECMWF is responsible for any use that may be made of the Copernicus information or data it contains. Based on ECMWF data (www.ecmwf.int).

Parameters

NameTypeRequiredDescription
latstringyesLatitude of the location (e.g. 41.8781 for Chicago) Also accepted as latitude. The example sends 41.8781.
lonstringyesLongitude of the location (e.g. -87.6298 for Chicago) Also accepted as lng, long, longitude. The example sends -87.6298.

Example request

curl -i -X POST https://agent402.tools/api/skill/energy-weather \
  -H "Content-Type: application/json" \
  -d '{"lat":"41.8781","lon":"-87.6298"}'

Watch a call get paid

RequestPOST /api/skill/energy-weather
402$0.016 USDC
SignPAYMENT-SIGNATURE
Settleon 14 chains
Answer200 OK
ReceiptAgent402-ReceiptEd25519

Example response

{
  "pack": "energy-weather",
  "args": {
    "lat": "41.8781",
    "lon": "-87.6298"
  },
  "steps": [
    {
      "slug": "degree-days",
      "ok": true,
      "result": {}
    },
    {
      "slug": "seasonal-outlook",
      "ok": true,
      "result": {}
    },
    {
      "slug": "solar-forecast",
      "ok": true,
      "result": {}
    },
    {
      "slug": "wind-power-forecast",
      "ok": true,
      "result": {}
    }
  ],
  "summary": "4/4 steps succeeded"
}
FieldTypeAlways presentIn the example
packstringyesenergy-weather
argsobjectyes2 fields: lat, lon
stepsarray of objectsyes4 items in the example
summarystringyes4/4 steps succeeded

From an MCP client

catalog.call {
  "slug": "skill-energy-weather",
  "params": {
    "lat": "41.8781",
    "lon": "-87.6298"
  }
}

Hosted connector (https://agent402.tools/mcp): paid in the call. Stdio package (npx -y agent402-mcp@0.19.2): pays from a wallet or AGENT402_CREDITS_KEY.

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.016" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/skill/energy-weather", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "lat": "41.8781",
    "lon": "-87.6298"
  }),
});

Get a wallet or run npx -y agent402-mcp@0.19.2 wallet new.

The quote (Python)

import base64, json, urllib.error, urllib.request

req = urllib.request.Request("https://agent402.tools/api/skill/energy-weather", method="POST", data="{\"lat\":\"41.8781\",\"lon\":\"-87.6298\"}".encode(), headers={"Content-Type": "application/json"})
try:
    urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
    quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
    print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]])  # the price, per chain, in base units

Related tools