Skip to main content
Glama

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
NameRequiredDescriptionDefault
cantonYes2-letter canton code (e.g. 'ZH', 'BE', 'GE', 'VS')

Implementation Reference

  • 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)",
      });
    }
  • 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')",
          },
        },
      },
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vikramgorla/mcp-swiss'

If you have feedback or need assistance with the MCP directory API, please join our Discord server