Skip to main content
Glama
robobobby
by robobobby

fi_weather_forecast

Get weather forecasts for Finnish locations up to 16 days ahead with hourly or daily detail options.

Instructions

Get hourly or daily weather forecast for a location in Finland. Up to 16 days ahead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationYesFinnish city name or lat,lon coordinates
daysNoForecast days (default 3, max 16)
modeNoHourly detail or daily summary (default: daily)

Implementation Reference

  • The handler for the 'fi_weather_forecast' tool. It fetches location coordinates, prepares Open-Meteo API parameters, and processes the response into a formatted string.
    async ({ location, days, mode }) => {
      try {
        const loc = await getLocation(location);
        const forecastDays = days || 3;
        const isHourly = mode === "hourly";
    
        const params = { latitude: loc.lat, longitude: loc.lon, forecast_days: forecastDays };
        if (isHourly) {
          params.hourly = "temperature_2m,apparent_temperature,precipitation,snowfall,weather_code,wind_speed_10m,wind_gusts_10m,cloud_cover";
        } else {
          params.daily = "weather_code,temperature_2m_max,temperature_2m_min,apparent_temperature_max,apparent_temperature_min,sunrise,sunset,precipitation_sum,snowfall_sum,wind_speed_10m_max,wind_gusts_10m_max,wind_direction_10m_dominant";
        }
    
        const data = await openMeteoFetch(params);
        const lines = [`## ${loc.name} — ${forecastDays}-Day Forecast\n`];
    
        if (isHourly) {
          const h = data.hourly;
          for (let i = 0; i < h.time.length; i++) {
            const t = new Date(h.time[i]);
            const time = t.toLocaleString("fi-FI", { timeZone: "Europe/Helsinki", weekday: "short", day: "numeric", month: "short", hour: "2-digit", minute: "2-digit" });
            const wx = WMO_CODES[h.weather_code[i]] || "";
            const snow = h.snowfall[i] > 0 ? `, snow ${h.snowfall[i]} cm` : "";
            lines.push(`**${time}:** ${h.temperature_2m[i]}°C (feels ${h.apparent_temperature[i]}°C), ${wx}, wind ${h.wind_speed_10m[i]} km/h, precip ${h.precipitation[i]} mm${snow}`);
          }
        } else {
          const d = data.daily;
          for (let i = 0; i < d.time.length; i++) {
            const date = new Date(d.time[i]);
            const day = date.toLocaleDateString("fi-FI", { timeZone: "Europe/Helsinki", weekday: "long", day: "numeric", month: "long" });
            const wx = WMO_CODES[d.weather_code[i]] || "";
            const sunrise = d.sunrise[i]?.split("T")[1] || "";
            const sunset = d.sunset[i]?.split("T")[1] || "";
            const snow = d.snowfall_sum[i] > 0 ? `\nSnowfall: ${d.snowfall_sum[i]} cm` : "";
            lines.push(`### ${day}`);
            lines.push(`${wx} | ${d.temperature_2m_min[i]}°C to ${d.temperature_2m_max[i]}°C (feels ${d.apparent_temperature_min[i]}° to ${d.apparent_temperature_max[i]}°)`);
            lines.push(`Wind: up to ${d.wind_speed_10m_max[i]} km/h (gusts ${d.wind_gusts_10m_max[i]} km/h) from ${d.wind_direction_10m_dominant[i]}°`);
            lines.push(`Precipitation: ${d.precipitation_sum[i]} mm${snow} | ☀️ ${sunrise} — ${sunset}\n`);
          }
        }
    
        lines.push(`*Open-Meteo forecast (Europe/Helsinki)*`);
        return { content: [{ type: "text", text: lines.join("\n") }] };
      } catch (err) {
        return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true };
      }
  • Registration of the 'fi_weather_forecast' tool, including input schema validation using Zod.
    server.tool(
      "fi_weather_forecast",
      "Get hourly or daily weather forecast for a location in Finland. Up to 16 days ahead.",
      {
        location: z.string().describe("Finnish city name or lat,lon coordinates"),
        days: z.number().min(1).max(16).optional().describe("Forecast days (default 3, max 16)"),
        mode: z.enum(["hourly", "daily"]).optional().describe("Hourly detail or daily summary (default: daily)"),
      },

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