UNPKG

clinicaltrialsgov-mcp-server

Version:

Search ClinicalTrials.gov trials, retrieve study details and results, and match patients to eligible trials via MCP. STDIO or Streamable HTTP.

32 lines 1.33 kB
/** * @fileoverview Geographic helpers shared by location-aware tools — great-circle * distance and parsing of the `geoFilter` center coordinates. * @module mcp-server/tools/utils/geo-helpers */ import type { StudyLocation } from '../../../services/clinical-trials/types.js'; /** Mean Earth radius in miles, used by the Haversine formula. */ export declare const EARTH_RADIUS_MI = 3958.7613; /** A study location annotated with its distance from a reference point. */ export type LocationWithDistance = StudyLocation & { distanceMi?: number; }; /** Great-circle distance in miles between two lat/lon points (Haversine). */ export declare function haversineMi(a: { lat: number; lon: number; }, b: { lat: number; lon: number; }): number; /** * Extract the center coordinates from a `geoFilter` value of the form * `distance(lat, lon, radius)`. The radius (with an optional `mi`/`km` suffix) is * already applied by the upstream query, so only lat/lon are returned here — used * to re-rank a study's locations by proximity. Tolerates surrounding whitespace. * Returns undefined when the value isn't a parseable distance expression. */ export declare function parseGeoFilterCenter(geoFilter: string | undefined): { lat: number; lon: number; } | undefined; //# sourceMappingURL=geo-helpers.d.ts.map