Skip to main content
Glama
robobobby
by robobobby

se_weather_forecast

Get weather forecasts for Swedish locations using SMHI data. Retrieve hourly weather predictions for up to 72 hours ahead to plan activities and prepare for changing conditions.

Instructions

Get weather forecast for a location in Sweden using SMHI. Returns hourly data for the next N hours.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationYesSwedish city name or lat,lon coordinates
hoursNoHours ahead (default 24, max 72)

Implementation Reference

  • Implementation and registration of the 'se_weather_forecast' tool.
    server.tool(
      "se_weather_forecast",
      "Get weather forecast for a location in Sweden using SMHI. Returns hourly data for the next N hours.",
      {
        location: z.string().describe("Swedish city name or lat,lon coordinates"),
        hours: z.number().min(1).max(72).optional().describe("Hours ahead (default 24, max 72)"),
      },
      async ({ location, hours }) => {
        try {
          const loc = await getLocation(location);
          const data = await fetchForecast(loc.lat, loc.lon);
          const maxHours = hours || 24;
          const now = Date.now();
          const cutoff = now + maxHours * 3600000;
    
          const lines = [`## ${loc.name} — ${maxHours}h Forecast\n`];
          for (const entry of data.timeSeries) {
            const t = new Date(entry.validTime);
            if (t.getTime() > cutoff) break;
            if (t.getTime() < now - 3600000) continue;
    
            const time = t.toLocaleString("sv-SE", { timeZone: "Europe/Stockholm", weekday: "short", day: "numeric", month: "short", hour: "2-digit", minute: "2-digit" });
            const p = entry.parameters;
            const temp = getParam(p, "t");
            const wind = getParam(p, "ws");
            const wsymb = getParam(p, "Wsymb2");
            const precip = getParam(p, "pmean");
    
            lines.push(`**${time}:** ${temp}°C, ${WSYMB2[wsymb] || ""}, wind ${wind} m/s${precip > 0 ? `, ${precip} mm/h` : ""}`);
          }
          lines.push(`\n*SMHI Open Data*`);
          return { content: [{ type: "text", text: lines.join("\n") }] };
        } catch (err) {
          return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true };
        }
      }
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/robobobby/mcp-nordic'

If you have feedback or need assistance with the MCP directory API, please join our Discord server