dk_current_weather
Retrieve current weather conditions for locations in Denmark using DMI HARMONIE high-resolution model. Accepts city names, coordinates, or postal codes.
Instructions
Get current weather conditions for a location in Denmark. Uses DMI HARMONIE high-resolution model (2km). Accepts city names, coordinates, or postal codes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| location | Yes | Danish city name (e.g. 'Copenhagen', 'Aarhus', 'Gilleleje'), postal code, or lat,lon coordinates |
Implementation Reference
- src/servers/danish-weather.js:123-148 (handler)The handler function that executes the dk_current_weather tool logic using Open-Meteo data.
async ({ location }) => { try { const loc = await getLocation(location); const data = await openMeteoFetch({ latitude: loc.lat, longitude: loc.lon, current: "temperature_2m,relative_humidity_2m,apparent_temperature,precipitation,weather_code,wind_speed_10m,wind_direction_10m,wind_gusts_10m,surface_pressure,cloud_cover", }); const c = data.current; const weather = WMO_CODES[c.weather_code] || `Code ${c.weather_code}`; const lines = [ `## ${loc.name} — Current Weather`, `**Conditions:** ${weather}`, `**Temperature:** ${c.temperature_2m}°C (feels like ${c.apparent_temperature}°C)`, `**Humidity:** ${c.relative_humidity_2m}%`, `**Wind:** ${c.wind_speed_10m} km/h from ${c.wind_direction_10m}° (gusts ${c.wind_gusts_10m} km/h)`, `**Pressure:** ${c.surface_pressure} hPa`, `**Cloud cover:** ${c.cloud_cover}%`, `**Precipitation:** ${c.precipitation} mm`, `\n*DMI HARMONIE model, ${data.current_units?.time || ""} ${c.time}*`, ]; 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:117-149 (registration)Registration of the dk_current_weather tool with the server.
server.tool( "dk_current_weather", "Get current weather conditions for a location in Denmark. Uses DMI HARMONIE high-resolution model (2km). Accepts city names, coordinates, or postal codes.", { location: z.string().describe("Danish city name (e.g. 'Copenhagen', 'Aarhus', 'Gilleleje'), postal code, or lat,lon coordinates"), }, async ({ location }) => { try { const loc = await getLocation(location); const data = await openMeteoFetch({ latitude: loc.lat, longitude: loc.lon, current: "temperature_2m,relative_humidity_2m,apparent_temperature,precipitation,weather_code,wind_speed_10m,wind_direction_10m,wind_gusts_10m,surface_pressure,cloud_cover", }); const c = data.current; const weather = WMO_CODES[c.weather_code] || `Code ${c.weather_code}`; const lines = [ `## ${loc.name} — Current Weather`, `**Conditions:** ${weather}`, `**Temperature:** ${c.temperature_2m}°C (feels like ${c.apparent_temperature}°C)`, `**Humidity:** ${c.relative_humidity_2m}%`, `**Wind:** ${c.wind_speed_10m} km/h from ${c.wind_direction_10m}° (gusts ${c.wind_gusts_10m} km/h)`, `**Pressure:** ${c.surface_pressure} hPa`, `**Cloud cover:** ${c.cloud_cover}%`, `**Precipitation:** ${c.precipitation} mm`, `\n*DMI HARMONIE model, ${data.current_units?.time || ""} ${c.time}*`, ]; return { content: [{ type: "text", text: lines.join("\n") }] }; } catch (err) { return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true }; } } ); - Input schema definition for the dk_current_weather tool.
{ location: z.string().describe("Danish city name (e.g. 'Copenhagen', 'Aarhus', 'Gilleleje'), postal code, or lat,lon coordinates"), },