get_weather_history
Retrieve historical weather data for Swiss stations by specifying station code and date range. Access past weather conditions for analysis or planning purposes.
Instructions
Get historical weather data for a Swiss station
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| station | Yes | Station code (e.g. BER) | |
| start_date | Yes | Start date YYYY-MM-DD | |
| end_date | Yes | End date YYYY-MM-DD |
Implementation Reference
- src/modules/weather.ts:197-212 (handler)The handler logic for "get_weather_history" which fetches historical weather data from the MeteoSwiss API.
case "get_weather_history": { const url = buildUrl(`${BASE}/smn/daterange`, { locations: args.station as string, startdt: args.start_date as string, enddt: args.end_date as string, app: "mcp-swiss", version: "0.1.0", }); const data = await fetchJSON<ApiResponse>(url); const payload = data?.payload; if (Array.isArray(payload)) { const records = extractReadings(payload); return JSON.stringify({ station: args.station, count: records.length, data: records }); } return JSON.stringify(data, null, 2); } - src/modules/weather.ts:76-87 (schema)The schema definition for the "get_weather_history" tool.
name: "get_weather_history", description: "Get historical weather data for a Swiss station", inputSchema: { type: "object", required: ["station", "start_date", "end_date"], properties: { station: { type: "string", description: "Station code (e.g. BER)" }, start_date: { type: "string", description: "Start date YYYY-MM-DD" }, end_date: { type: "string", description: "End date YYYY-MM-DD" }, }, }, },