Skip to main content
Glama

search_earthquakes_by_location

Find seismic activity near Swiss locations using coordinates. Filter earthquakes by radius, time period, and magnitude to monitor local geological events.

Instructions

Search for earthquakes near a geographic location using the Swiss Seismological Service (SED) FDSN API. Useful for finding seismic activity near a Swiss city, landmark, or custom coordinates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latYesLatitude of the center point (decimal degrees, e.g. 46.9 for Bern)
lonYesLongitude of the center point (decimal degrees, e.g. 7.5 for Bern)
radius_kmNoSearch radius in kilometres (default: 50, max: 500)
daysNoNumber of past days to search (default: 90, max: 365)
min_magnitudeNoMinimum magnitude filter (default: 0.5)
limitNoMaximum number of results to return (default: 20, max: 100)

Implementation Reference

  • The handler function that executes the search_earthquakes_by_location tool logic.
    async function handleSearchEarthquakesByLocation(
      args: Record<string, string | number>
    ): Promise<string> {
      const lat = Number(args.lat);
      const lon = Number(args.lon);
    
      if (isNaN(lat) || isNaN(lon)) {
        throw new Error("lat and lon must be valid numbers");
      }
    
      const radiusKm = Math.min(Number(args.radius_km ?? 50), 500);
      const days = Math.min(Number(args.days ?? 90), 365);
      const minMag = Number(args.min_magnitude ?? 0.5);
      const limit = Math.min(Number(args.limit ?? 20), 100);
    
      // SED FDSN uses maxradius in degrees, not km. Convert: 1 degree ≈ 111.12 km
      const maxRadiusDeg = radiusKm / 111.12;
    
      const url = buildUrl(BASE, {
        latitude: lat,
        longitude: lon,
        maxradius: maxRadiusDeg,
        starttime: startTimeISO(days),
        minmagnitude: minMag,
        limit: limit,
        format: "text",
        orderby: "time",
      });
    
      const raw = await fetchFdsnText(url);
    
      if (!raw) {
        return JSON.stringify({
          count: 0,
          events: [],
          center: { lat, lon },
          radius_km: radiusKm,
          days_searched: days,
          min_magnitude: minMag,
          limit,
          source: "Swiss Seismological Service (SED), ETH Zürich",
          note: "No events found near the given location.",
        });
      }
    
      const events = parseFdsnText(raw);
    
      return JSON.stringify({
        count: events.length,
        center: { lat, lon },
        radius_km: radiusKm,
        days_searched: days,
        min_magnitude: minMag,
        limit,
        source: "Swiss Seismological Service (SED), ETH Zürich",
        api: "FDSN Event Web Service — http://arclink.ethz.ch/fdsnws/event/1/",
        events,
      });
    }
  • Input schema definition for the search_earthquakes_by_location tool.
    name: "search_earthquakes_by_location",
    description:
      "Search for earthquakes near a geographic location using the Swiss Seismological Service (SED) FDSN API. " +
      "Useful for finding seismic activity near a Swiss city, landmark, or custom coordinates.",
    inputSchema: {
      type: "object",
      required: ["lat", "lon"],
      properties: {
        lat: {
          type: "number",
          description: "Latitude of the center point (decimal degrees, e.g. 46.9 for Bern)",
        },
        lon: {
          type: "number",
          description: "Longitude of the center point (decimal degrees, e.g. 7.5 for Bern)",
        },
        radius_km: {
          type: "number",
          description: "Search radius in kilometres (default: 50, max: 500)",
        },
        days: {
          type: "number",
          description: "Number of past days to search (default: 90, max: 365)",
        },
        min_magnitude: {
          type: "number",
          description: "Minimum magnitude filter (default: 0.5)",
        },
        limit: {
          type: "number",
          description: "Maximum number of results to return (default: 20, max: 100)",
        },
      },
    },
  • Tool call dispatching/registration within the module handler.
    case "search_earthquakes_by_location":
      return handleSearchEarthquakesByLocation(args as Record<string, string | number>);
    default:

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