Skip to main content
Glama

get_snow_measurements

Retrieve detailed snow and weather measurements from Swiss SLF stations, including snow depth, temperature, humidity, wind, and radiation data for monitoring and analysis.

Instructions

Get detailed snow and weather measurements for a specific SLF station. IMIS stations return 30-min data (snow depth, temperature, humidity, wind, radiation). Study plots return daily data (snow depth, new snow, water equivalent). Use list_snow_stations to find station codes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
station_codeYesStation code (e.g. DAV2, WFJ2, 4AO0). Use list_snow_stations to find codes.
typeNoStation type: "imis" (default) or "study-plot". Determines which API endpoint to query.

Implementation Reference

  • The handler function `handleGetSnowMeasurements` processes the request for snow measurements for a specific station, handles different station types (IMIS vs study-plot), fetches data from the SLF API, and formats the output.
    async function handleGetSnowMeasurements(
      args: Record<string, unknown>
    ): Promise<string> {
      const stationCode = args.station_code;
      if (typeof stationCode !== "string" || !stationCode.trim()) {
        throw new Error("station_code is required");
      }
      const code = stationCode.trim();
      const stationType =
        typeof args.type === "string" && args.type.trim().toLowerCase() === "study-plot"
          ? "study-plot"
          : "imis";
    
      if (stationType === "study-plot") {
        const measurements = await fetchJSON<StudyPlotMeasurement[]>(
          `${BASE}/study-plot/station/${encodeURIComponent(code)}/measurements`
        );
    
        const latest = measurements.slice(-10).reverse().map((m) => ({
          time: m.measure_date,
          snow_depth_cm: m.HS,
          new_snow_24h_cm: m.HN_1D,
          new_snow_water_equiv_mm: m.HNW_1D,
        }));
    
        return JSON.stringify({
          station_code: code,
          type: "study-plot",
          measurement_count: latest.length,
          measurements: latest,
          source: "WSL Institute for Snow and Avalanche Research SLF (CC BY 4.0)",
        });
      }
    
      // IMIS station
      const measurements = await fetchJSON<ImisMeasurement[]>(
        `${BASE}/imis/station/${encodeURIComponent(code)}/measurements`
      );
    
      // Return latest 10 measurements, most recent first, with readable field names
      const latest = measurements.slice(-10).reverse().map((m) => ({
        time: m.measure_date,
        snow_depth_cm: m.HS,
        air_temp_c: m.TA_30MIN_MEAN,
        humidity_pct: m.RH_30MIN_MEAN,
        surface_temp_c: m.TSS_30MIN_MEAN,
        ground_temp_0cm_c: m.TS0_30MIN_MEAN,
        reflected_radiation_w_m2: m.RSWR_30MIN_MEAN,
        wind_speed_m_s: m.VW_30MIN_MEAN,
        wind_gust_m_s: m.VW_30MIN_MAX,
        wind_direction_deg: m.DW_30MIN_MEAN,
      }));
    
      return JSON.stringify({
        station_code: code,
        type: "imis",
        measurement_count: latest.length,
        measurements: latest,
        fields: {
          snow_depth_cm: "Total snow depth (HS)",
          air_temp_c: "Air temperature 30-min mean",
          humidity_pct: "Relative humidity 30-min mean",
          surface_temp_c: "Snow surface temperature",
          reflected_radiation_w_m2: "Reflected shortwave radiation",
          wind_speed_m_s: "Wind speed 30-min mean",
          wind_gust_m_s: "Wind gust 30-min max",
          wind_direction_deg: "Wind direction 30-min mean",
        },
        source: "WSL Institute for Snow and Avalanche Research SLF (CC BY 4.0)",
      });
    }
  • The tool definition for `get_snow_measurements` includes its description and input schema.
        name: "get_snow_measurements",
        description:
          "Get detailed snow and weather measurements for a specific SLF station. " +
          "IMIS stations return 30-min data (snow depth, temperature, humidity, wind, radiation). " +
          "Study plots return daily data (snow depth, new snow, water equivalent). " +
          "Use list_snow_stations to find station codes.",
        inputSchema: {
          type: "object",
          required: ["station_code"],
          properties: {
            station_code: {
              type: "string",
              description:
                "Station code (e.g. DAV2, WFJ2, 4AO0). Use list_snow_stations to find codes.",
            },
            type: {
              type: "string",
              enum: ["imis", "study-plot"],
              description:
                'Station type: "imis" (default) or "study-plot". Determines which API endpoint to query.',
            },
          },
        },
      },
    ];
  • Registration of the tool within the `handleSnow` dispatcher.
    case "get_snow_measurements":
      return handleGetSnowMeasurements(args);

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/vikramgorla/mcp-swiss'

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