Weather Check
CommunityGet current weather for any city using OpenMeteo API (no key required).
Installation
Save as `weather.js`. Usage: `weather <lat> <lon>`.
Source Code
JavaScriptTutorial.terminal
// weather.js
// Description: Get weather for a location (lat, lon)
module.exports = async function(context) {
// Default to San Francisco if no args
const lat = context.args[0] || 37.7749;
const lon = context.args[1] || -122.4194;
const url = `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}¤t_weather=true`;
const response = await fetch(url);
const data = await response.json();
return {
location: { lat, lon },
weather: data.current_weather
};
};
Live Preview
β Live DemoAgent Session
How to use
- Ensure you have the necessary dependencies installed (if any).
- Place the file in your OpenClaw skills folder (e.g., ~/.openclaw/skills/).
- Restart your agent or reload configuration.
- Invoke it using the filename (without extension) as the tool name, or through natural language if the description is clear.