list_snow_stations
Retrieve Swiss snow measurement station data including location, altitude, and type. Filter by canton or station type to access SLF automatic and manual snow monitoring information.
Instructions
List all SLF snow measurement stations in Switzerland (IMIS automatic stations and manual study plots). Returns station code, name, altitude, canton, and type. Sorted by elevation descending.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| canton | No | Filter by canton abbreviation (e.g. GR, VS, BE). Optional. | |
| type | No | Station type: "imis" (automatic) or "study-plot" (manual). Optional — returns both by default. | |
| limit | No | Maximum number of stations to return (default: 20, max: 200). |
Implementation Reference
- src/modules/snow.ts:211-264 (handler)Handler function for the 'list_snow_stations' tool. It fetches station data from IMIS and study plots, merges, filters, and formats the result.
async function handleListSnowStations( args: Record<string, unknown> ): Promise<string> { const canton = typeof args.canton === "string" ? args.canton.trim().toUpperCase() : undefined; const typeFilter = typeof args.type === "string" ? args.type.trim().toLowerCase() : undefined; const limit = Math.min(Math.max(Number(args.limit) || 20, 1), 200); // Fetch station lists (conditionally based on type filter) const fetchImis = !typeFilter || typeFilter === "imis"; const fetchStudy = !typeFilter || typeFilter === "study-plot"; const [imisStations, studyStations] = await Promise.all([ fetchImis ? fetchJSON<ImisStation[]>(`${BASE}/imis/stations`) : Promise.resolve([]), fetchStudy ? fetchJSON<StudyPlotStation[]>(`${BASE}/study-plot/stations`) : Promise.resolve([]), ]); type StationEntry = { code: string; name: string; altitude_m: number; canton: string; type: string; }; const combined: StationEntry[] = [ ...imisStations.map((s) => ({ code: s.code, name: s.label, altitude_m: s.elevation, canton: s.canton_code, type: "imis" as const, })), ...studyStations.map((s) => ({ code: s.code, name: s.label, altitude_m: s.elevation, canton: s.canton_code, type: "study-plot" as const, })), ]; const filtered = combined .filter((s) => !canton || s.canton === canton) .sort((a, b) => b.altitude_m - a.altitude_m) .slice(0, limit); return JSON.stringify({ count: filtered.length, total_stations: combined.length, ...(canton ? { canton } : {}), ...(typeFilter ? { type: typeFilter } : {}), stations: filtered, source: "WSL Institute for Snow and Avalanche Research SLF (CC BY 4.0)", });