Skip to main content
Glama

get_traffic_nearby

Find nearby traffic counting stations in Switzerland with current volume data. Input coordinates to get traffic monitoring points within a specified radius.

Instructions

Find ASTRA traffic counting stations near a geographic coordinate in Switzerland. Returns nearby stations with traffic volume data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latYesLatitude in WGS84 (e.g. 47.3769 for Zürich)
lonYesLongitude in WGS84 (e.g. 8.5417 for Zürich)
radiusNoSearch radius in meters (default: 5000)

Implementation Reference

  • The handler logic for 'get_traffic_nearby' which converts coordinates to LV95 and queries the ASTRA API.
    case "get_traffic_nearby": {
      const lat = args.lat as number;
      const lon = args.lon as number;
      const radius = (args.radius as number | undefined) ?? 5000;
    
      const [e, n] = wgs84ToLv95(lat, lon);
    
      // Build a map extent around the point using the radius
      const extentPadding = radius * 3;
      const mapExtent = `${e - extentPadding},${n - extentPadding},${e + extentPadding},${n + extentPadding}`;
    
      const url = buildUrl(`${GEO_ADMIN}/identify`, {
        geometry: `${e},${n}`,
        geometryType: "esriGeometryPoint",
        tolerance: radius,
        mapExtent,
        imageDisplay: "1,1,96",
        layers: `all:${TRAFFIC_LAYER}`,
        returnGeometry: false,
      });
      const data = await fetchJSON<IdentifyResponse>(url);
      const stations = data.results.map(slimTrafficStation);
      return JSON.stringify({
        count: stations.length,
        lat,
        lon,
        radius_m: radius,
        stations,
        source: "ASTRA — Federal Roads Office (Bundesamt für Strassen)",
      });
    }
  • The MCP tool definition and input schema for 'get_traffic_nearby'.
      name: "get_traffic_nearby",
      description:
        "Find ASTRA traffic counting stations near a geographic coordinate in Switzerland. Returns nearby stations with traffic volume data.",
      inputSchema: {
        type: "object",
        required: ["lat", "lon"],
        properties: {
          lat: {
            type: "number",
            description: "Latitude in WGS84 (e.g. 47.3769 for Zürich)",
          },
          lon: {
            type: "number",
            description: "Longitude in WGS84 (e.g. 8.5417 for Zürich)",
          },
          radius: {
            type: "number",
            description: "Search radius in meters (default: 5000)",
          },
        },
      },
    },

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