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
| Name | Required | Description | Default |
|---|---|---|---|
| lat | Yes | Latitude of the center point (decimal degrees, e.g. 46.9 for Bern) | |
| lon | Yes | Longitude of the center point (decimal degrees, e.g. 7.5 for Bern) | |
| radius_km | No | Search radius in kilometres (default: 50, max: 500) | |
| days | No | Number of past days to search (default: 90, max: 365) | |
| min_magnitude | No | Minimum magnitude filter (default: 0.5) | |
| limit | No | Maximum number of results to return (default: 20, max: 100) |
Implementation Reference
- src/modules/earthquakes.ts:312-370 (handler)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, }); } - src/modules/earthquakes.ts:93-126 (schema)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)", }, }, }, - src/modules/earthquakes.ts:383-385 (registration)Tool call dispatching/registration within the module handler.
case "search_earthquakes_by_location": return handleSearchEarthquakesByLocation(args as Record<string, string | number>); default: