get_water_history
Retrieve historical water level data for Swiss hydrological stations to analyze river and lake trends over specified date ranges.
Instructions
Get historical river/lake water level data for a Swiss hydrological station
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| station | Yes | Hydro station ID | |
| start_date | Yes | Start date YYYY-MM-DD | |
| end_date | Yes | End date YYYY-MM-DD |
Implementation Reference
- src/modules/weather.ts:237-252 (handler)The handler function for 'get_water_history' which constructs the API request to the BAFU hydrological historical data endpoint and formats the response.
case "get_water_history": { const url = buildUrl(`${BASE}/hydro/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:108-119 (schema)The definition of the 'get_water_history' tool, including its name, description, and required parameters (station, start_date, end_date).
name: "get_water_history", description: "Get historical river/lake water level data for a Swiss hydrological station", inputSchema: { type: "object", required: ["station", "start_date", "end_date"], properties: { station: { type: "string", description: "Hydro station ID" }, start_date: { type: "string", description: "Start date YYYY-MM-DD" }, end_date: { type: "string", description: "End date YYYY-MM-DD" }, }, }, },