get_air_quality
Retrieve Swiss air quality data for specific monitoring stations, including location details, environmental type, legal limits, and live data portal links.
Instructions
Get information about a Swiss NABEL air quality monitoring station, including location, environment type, Swiss legal limits (LRV), and a direct link to the BAFU live data portal. Use station codes from list_air_quality_stations (e.g. BER=Bern, ZUE=Zürich, LUG=Lugano).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| station | Yes | NABEL station code (e.g. BER, ZUE, LUG, BAS, DAV). Use list_air_quality_stations for all codes. |
Implementation Reference
- src/modules/airquality.ts:139-179 (handler)Implementation of the 'get_air_quality' tool handler logic.
case "get_air_quality": { const code = normalizeStationCode(args.station as string); const local = NABEL_STATIONS[code]; if (!local) { const knownCodes = Object.keys(NABEL_STATIONS).join(", "); throw new Error( `Unknown NABEL station code "${code}". Known stations: ${knownCodes}. ` + `Use list_air_quality_stations to see all options.` ); } // Optionally enrich from live geo.admin.ch API (non-blocking fallback) let apiName: string | undefined; try { const feature = await fetchStationFromApi(code); apiName = feature?.attributes?.name; } catch { // continue with local data } const stationName = apiName ?? local.name; return JSON.stringify({ station: code, name: stationName, canton: local.canton, coordinates: { lat: local.lat, lon: local.lon }, altitude_m: local.altitude_m, environment: local.environment, network: "NABEL", operator: "BAFU / EMPA", source: "geo.admin.ch — ch.bafu.nabelstationen", data_note: "Live NABEL measurements (PM10, PM2.5, O3, NO2, SO2) are published on the BAFU data portal. " + "No public REST API for real-time values — use the portal link below.", live_data_portal: "https://www.bafu.admin.ch/bafu/en/home/topics/air/state/data/nabel.html", swiss_legal_limits_lrv: SWISS_LIMITS, limits_reference: "LRV (Luftreinhalteordnung / Swiss Clean Air Act, Annex 7)", }); } - src/modules/airquality.ts:82-97 (registration)Tool definition and schema for 'get_air_quality'.
{ name: "get_air_quality", description: "Get information about a Swiss NABEL air quality monitoring station, including location, environment type, Swiss legal limits (LRV), and a direct link to the BAFU live data portal. Use station codes from list_air_quality_stations (e.g. BER=Bern, ZUE=Zürich, LUG=Lugano).", inputSchema: { type: "object", required: ["station"], properties: { station: { type: "string", description: "NABEL station code (e.g. BER, ZUE, LUG, BAS, DAV). Use list_air_quality_stations for all codes.", }, }, }, },