dk_compare_weather
Compare current weather conditions between two Danish locations to inform travel decisions or analyze regional climate differences.
Instructions
Compare current weather between two Danish locations side by side. Useful for deciding between destinations or comparing conditions across the country.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| location1 | Yes | First location (city name, postal code, or coordinates) | |
| location2 | Yes | Second location |
Implementation Reference
- src/servers/danish-weather.js:215-246 (handler)The handler function for dk_compare_weather which fetches and compares weather data for two locations.
async ({ location1, location2 }) => { try { const [loc1, loc2] = await Promise.all([getLocation(location1), getLocation(location2)]); const [data1, data2] = await Promise.all([ openMeteoFetch({ latitude: loc1.lat, longitude: loc1.lon, current: "temperature_2m,apparent_temperature,precipitation,weather_code,wind_speed_10m,cloud_cover", }), openMeteoFetch({ latitude: loc2.lat, longitude: loc2.lon, current: "temperature_2m,apparent_temperature,precipitation,weather_code,wind_speed_10m,cloud_cover", }), ]); const c1 = data1.current, c2 = data2.current; const wx1 = WMO_CODES[c1.weather_code] || "", wx2 = WMO_CODES[c2.weather_code] || ""; const lines = [ `## Weather Comparison\n`, `| | ${loc1.name} | ${loc2.name} |`, `|---|---|---|`, `| **Conditions** | ${wx1} | ${wx2} |`, `| **Temperature** | ${c1.temperature_2m}°C | ${c2.temperature_2m}°C |`, `| **Feels like** | ${c1.apparent_temperature}°C | ${c2.apparent_temperature}°C |`, `| **Wind** | ${c1.wind_speed_10m} km/h | ${c2.wind_speed_10m} km/h |`, `| **Cloud cover** | ${c1.cloud_cover}% | ${c2.cloud_cover}% |`, `| **Precipitation** | ${c1.precipitation} mm | ${c2.precipitation} mm |`, `\n*DMI HARMONIE 2km model*`, ]; return { content: [{ type: "text", text: lines.join("\n") }] }; } catch (err) { return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true }; } } - src/servers/danish-weather.js:208-214 (registration)Registration of the dk_compare_weather tool, including its name, description, and input schema.
server.tool( "dk_compare_weather", "Compare current weather between two Danish locations side by side. Useful for deciding between destinations or comparing conditions across the country.", { location1: z.string().describe("First location (city name, postal code, or coordinates)"), location2: z.string().describe("Second location"), },