get_traffic_by_canton
Retrieve traffic counting station data for Swiss cantons. Access up to 20 stations with traffic measurements using 2-letter canton codes.
Instructions
List ASTRA traffic counting stations in a Swiss canton. Returns up to 20 stations with traffic data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| canton | Yes | 2-letter canton code (e.g. 'ZH', 'BE', 'GE', 'VS') |
Implementation Reference
- src/modules/traffic.ts:164-182 (handler)The handler implementation for the 'get_traffic_by_canton' tool, which processes the request, calls the ASTRA API, and formats the output.
case "get_traffic_by_canton": { const canton = (args.canton as string).toUpperCase(); const url = buildUrl(`${GEO_ADMIN}/find`, { layer: TRAFFIC_LAYER, searchText: canton, searchField: "canton", returnGeometry: false, }); const data = await fetchJSON<FindResponse>(url); const stations = data.results.slice(0, 20).map(slimTrafficStation); return JSON.stringify({ count: stations.length, total: data.results.length, canton, stations, source: "ASTRA — Federal Roads Office (Bundesamt für Strassen)", }); } - src/modules/traffic.ts:102-116 (schema)The schema definition for the 'get_traffic_by_canton' tool, specifying the required 'canton' input parameter.
{ name: "get_traffic_by_canton", description: "List ASTRA traffic counting stations in a Swiss canton. Returns up to 20 stations with traffic data.", inputSchema: { type: "object", required: ["canton"], properties: { canton: { type: "string", description: "2-letter canton code (e.g. 'ZH', 'BE', 'GE', 'VS')", }, }, }, },