get_weather
Retrieve current weather conditions for Swiss locations using MeteoSwiss station codes like BER, ZUE, or LUG.
Instructions
Get current weather conditions at a Swiss MeteoSwiss station (e.g. BER=Bern, ZUE=Zürich, LUG=Lugano)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| station | Yes | Station code (e.g. BER, ZUE, LUG, GVE, SMA) |
Implementation Reference
- src/modules/weather.ts:164-187 (handler)The handler implementation for the "get_weather" tool, which fetches data from the MeteoSwiss API and formats the response.
case "get_weather": { const url = buildUrl(`${BASE}/smn/latest`, { locations: args.station as string, app: "mcp-swiss", version: "0.1.0", }); const data = await fetchJSON<ApiResponse>(url); const payload = data?.payload; if (Array.isArray(payload)) { const ts = payload[0]?.timestamp; const readings: Record<string, number> = {}; for (const p of payload) { const key = PARAM_NAMES[p.par] ?? p.par; readings[key] = p.val; } return JSON.stringify({ station: args.station, timestamp: toISO(ts), ...readings, source: "MeteoSwiss via SwissMetNet", }); } return JSON.stringify(data, null, 2); } - src/modules/weather.ts:56-66 (schema)The definition and input schema for the "get_weather" tool.
{ name: "get_weather", description: "Get current weather conditions at a Swiss MeteoSwiss station (e.g. BER=Bern, ZUE=Zürich, LUG=Lugano)", inputSchema: { type: "object", required: ["station"], properties: { station: { type: "string", description: "Station code (e.g. BER, ZUE, LUG, GVE, SMA)" }, }, }, },