Skip to main content
Glama

get_recent_earthquakes

Retrieve seismic events in Switzerland from the Swiss Seismological Service. Filter by date range, magnitude, and event type to access earthquake data.

Instructions

Get recent seismic events in and around Switzerland from the Swiss Seismological Service (SED) at ETH Zürich. Returns earthquakes and optionally quarry blasts, sorted by most recent first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNoNumber of past days to search (default: 30, max: 365)
min_magnitudeNoMinimum magnitude filter (default: 0.5)
limitNoMaximum number of results to return (default: 20)
include_blastsNoInclude quarry blasts in results (default: false — earthquakes only)

Implementation Reference

  • The handler function that implements the logic for get_recent_earthquakes, fetching and processing earthquake data from the SED service.
    async function handleGetRecentEarthquakes(
      args: Record<string, string | number | boolean>
    ): Promise<string> {
      const days = Math.min(Number(args.days ?? 30), 365);
      const minMag = Number(args.min_magnitude ?? 0.5);
      const limit = Number(args.limit ?? 20);
      const includeBlasts = args.include_blasts === true || args.include_blasts === "true";
    
      const url = buildUrl(BASE, {
        starttime: startTimeISO(days),
        minmagnitude: minMag,
        limit: limit,
        format: "text",
        orderby: "time",
      });
    
      const raw = await fetchFdsnText(url);
    
      if (!raw) {
        return JSON.stringify({
          count: 0,
          events: [],
          source: "Swiss Seismological Service (SED), ETH Zürich",
          note: "No events found for the given criteria.",
        });
      }
    
      let events = parseFdsnText(raw);
    
      // Filter out quarry blasts unless explicitly requested
      if (!includeBlasts) {
        events = events.filter((e) => e.event_type.toLowerCase() !== "quarry blast");
      }
    
      const result = JSON.stringify({
        count: events.length,
        days_searched: days,
        min_magnitude: minMag,
        include_blasts: includeBlasts,
        source: "Swiss Seismological Service (SED), ETH Zürich",
        api: "FDSN Event Web Service — http://arclink.ethz.ch/fdsnws/event/1/",
        events,
      });
    
      if (result.length > 50000) {
        // Trim to stay under 50K
        const trimmed = events.slice(0, Math.max(1, Math.floor(events.length * 0.8)));
        return JSON.stringify({
          count: trimmed.length,
          truncated: true,
          days_searched: days,
          min_magnitude: minMag,
          include_blasts: includeBlasts,
          source: "Swiss Seismological Service (SED), ETH Zürich",
          api: "FDSN Event Web Service — http://arclink.ethz.ch/fdsnws/event/1/",
          events: trimmed,
        });
      }
    
      return result;
    }
  • The schema definition for get_recent_earthquakes, defining its name, description, and input parameters.
    {
      name: "get_recent_earthquakes",
      description:
        "Get recent seismic events in and around Switzerland from the Swiss Seismological Service (SED) at ETH Zürich. " +
        "Returns earthquakes and optionally quarry blasts, sorted by most recent first.",
      inputSchema: {
        type: "object",
        properties: {
          days: {
            type: "number",
            description: "Number of past days to search (default: 30, 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)",
          },
          include_blasts: {
            type: "boolean",
            description: "Include quarry blasts in results (default: false — earthquakes only)",
          },
        },
      },
    },
  • The registration/dispatching logic that links the tool name "get_recent_earthquakes" to the handler function.
    case "get_recent_earthquakes":
      return handleGetRecentEarthquakes(args);

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