Skip to main content
Glama

get_snow_conditions

Retrieve current snow depth and 24-hour snowfall data for Swiss mountain stations to assess skiing, hiking, or avalanche conditions. Filter by canton or altitude for targeted information.

Instructions

Get current snow conditions across Switzerland from SLF (WSL Institute for Snow and Avalanche Research). Returns snow depth and new snow (24h) for IMIS stations, sorted by snow depth. Filter by canton or minimum altitude. Data updated daily.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cantonNoFilter by canton abbreviation (e.g. GR, VS, BE, UR, TI). Optional.
min_altitudeNoMinimum station altitude in metres (e.g. 2000). Optional.
limitNoMaximum number of stations to return (default: 20, max: 100).

Implementation Reference

  • The logic that fetches, filters, and processes snow condition data.
    async function handleGetSnowConditions(
      args: Record<string, unknown>
    ): Promise<string> {
      const canton = typeof args.canton === "string" ? args.canton.trim().toUpperCase() : undefined;
      const minAlt = typeof args.min_altitude === "number" ? args.min_altitude : undefined;
      const limit = Math.min(Math.max(Number(args.limit) || 20, 1), 100);
    
      // Fetch snow data and station metadata in parallel
      const [dailySnow, stations] = await Promise.all([
        fetchJSON<DailySnow[]>(`${BASE}/imis/daily-snow`),
        fetchJSON<ImisStation[]>(`${BASE}/imis/stations`),
      ]);
    
      // Build station lookup
      const stationMap = new Map<string, ImisStation>();
      for (const s of stations) {
        stationMap.set(s.code, s);
      }
    
      // Join, filter, sort
      const joined = dailySnow
        .map((d) => {
          const s = stationMap.get(d.station_code);
          if (!s) return null;
          return {
            station: s.label,
            code: s.code,
            altitude_m: s.elevation,
            canton: s.canton_code,
            snow_depth_cm: d.HS,
            new_snow_24h_cm: d.HN_1D,
            date: d.measure_date?.slice(0, 10) ?? null,
          };
        })
        .filter((r): r is NonNullable<typeof r> => {
          if (!r) return false;
          if (canton && r.canton !== canton) return false;
          if (minAlt !== undefined && r.altitude_m < minAlt) return false;
          return true;
        })
        .sort((a, b) => (b.snow_depth_cm ?? 0) - (a.snow_depth_cm ?? 0))
        .slice(0, limit);
    
      return JSON.stringify({
        count: joined.length,
        filters: {
          ...(canton ? { canton } : {}),
          ...(minAlt !== undefined ? { min_altitude_m: minAlt } : {}),
        },
        stations: joined,
        source: "WSL Institute for Snow and Avalanche Research SLF (CC BY 4.0)",
      });
    }
  • The registration of the 'get_snow_conditions' tool within the 'snowTools' array.
    export const snowTools = [
      {
        name: "get_snow_conditions",
        description:
          "Get current snow conditions across Switzerland from SLF (WSL Institute for Snow and Avalanche Research). " +
          "Returns snow depth and new snow (24h) for IMIS stations, sorted by snow depth. " +
          "Filter by canton or minimum altitude. Data updated daily.",
        inputSchema: {
          type: "object",
          properties: {
            canton: {
              type: "string",
              description:
                "Filter by canton abbreviation (e.g. GR, VS, BE, UR, TI). Optional.",
            },
            min_altitude: {
              type: "number",
              description:
                "Minimum station altitude in metres (e.g. 2000). Optional.",
            },
            limit: {
              type: "number",
  • The JSON schema definition for the 'get_snow_conditions' input parameters.
    inputSchema: {
      type: "object",
      properties: {
        canton: {
          type: "string",
          description:
            "Filter by canton abbreviation (e.g. GR, VS, BE, UR, TI). Optional.",
        },
        min_altitude: {
          type: "number",
          description:
            "Minimum station altitude in metres (e.g. 2000). Optional.",
        },
        limit: {
          type: "number",

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