no_current_weather
Retrieve current weather conditions for Norwegian locations using MET Norway data, including temperature, wind, precipitation, humidity, and cloud cover.
Instructions
Get current weather for a location in Norway using MET Norway (yr.no). Includes temperature, wind, precipitation, humidity, and cloud cover.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| location | Yes | Norwegian city name (e.g. 'Oslo', 'Bergen', 'Tromsø', 'Lofoten') or lat,lon coordinates |
Implementation Reference
- src/servers/norwegian-weather.js:108-144 (handler)The 'no_current_weather' tool is registered and implemented within the server.tool block in src/servers/norwegian-weather.js. It fetches weather data from the MET Norway API and formats it into a text response.
server.tool( "no_current_weather", "Get current weather for a location in Norway using MET Norway (yr.no). Includes temperature, wind, precipitation, humidity, and cloud cover.", { location: z.string().describe("Norwegian city name (e.g. 'Oslo', 'Bergen', 'Tromsø', 'Lofoten') or lat,lon coordinates"), }, async ({ location }) => { try { const loc = await getLocation(location); const data = await fetchForecast(loc.lat, loc.lon); const ts = data.properties.timeseries; if (!ts?.length) throw new Error("No forecast data available"); const now = ts[0]; const inst = now.data.instant.details; const symbol = now.data.next_1_hours?.summary?.symbol_code || now.data.next_6_hours?.summary?.symbol_code || ""; const precip1h = now.data.next_1_hours?.details?.precipitation_amount; const lines = [ `## ${loc.name} — Current Weather`, `**Conditions:** ${symbolToText(symbol)}`, `**Temperature:** ${inst.air_temperature}°C`, `**Humidity:** ${inst.relative_humidity}%`, `**Wind:** ${inst.wind_speed} m/s from ${inst.wind_from_direction}° (gusts ${inst.wind_speed_of_gust ?? "N/A"} m/s)`, `**Pressure:** ${inst.air_pressure_at_sea_level} hPa`, `**Cloud cover:** ${inst.cloud_area_fraction}%`, precip1h != null ? `**Precipitation (next hour):** ${precip1h} mm` : null, `\n*MET Norway Locationforecast 2.0 — ${now.time}*`, ].filter(Boolean); return { content: [{ type: "text", text: lines.join("\n") }] }; } catch (err) { return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true }; } } );