list_weather_stations
Retrieve a comprehensive list of MeteoSwiss weather stations across Switzerland to access meteorological data sources.
Instructions
List all available MeteoSwiss weather stations in Switzerland
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/modules/weather.ts:189-195 (handler)The handler logic for the 'list_weather_stations' tool. It fetches station data from the API and formats it using 'compactWeatherStations'.
case "list_weather_stations": { const url = buildUrl(`${BASE}/smn/locations`, { app: "mcp-swiss" }); const data = await fetchJSON<ApiResponse>(url); const payload = (data?.payload ?? {}) as Record<string, StationEntry>; const stations = compactWeatherStations(payload); return JSON.stringify({ count: Object.keys(stations).length, stations }); } - src/modules/weather.ts:67-74 (schema)The tool definition for 'list_weather_stations', including its description and empty input schema.
{ name: "list_weather_stations", description: "List all available MeteoSwiss weather stations in Switzerland", inputSchema: { type: "object", properties: {}, }, }, - src/modules/weather.ts:136-145 (helper)Helper function that parses and formats raw weather station data for the 'list_weather_stations' tool.
function compactWeatherStations(payload: Record<string, StationEntry>): Record<string, string> { const result: Record<string, string> = {}; for (const s of Object.values(payload)) { const code = s.details?.id ?? s.name; const name = s.details?.name ?? s.name; const canton = s.details?.canton; result[code] = canton ? `${name} (${canton})` : name; } return result; }