---
summary: "geoFilter searches lead with the matched site (distanceMi), get_field_values flags multi-valued fields, and query parse errors drop the raw Essie grammar dump"
breaking: false
security: false
---

# 2.7.4 — 2026-06-21

## Added

- **`search_studies` geoFilter site re-ranking** — when `geoFilter` is set, each study's `locations[]` is re-sorted by proximity to the `distance(lat,lon,radius)` center so the matched site leads instead of the upstream-order first entry, and the nearest site renders with its `distanceMi`. Sites without a `geoPoint` are preserved at the end — re-rank only, never filter. Mirrors `get_study_record`'s `nearLocation` → `distanceMi` pattern. New shared `src/mcp-server/tools/utils/geo-helpers.ts` holds `haversineMi`, `parseGeoFilterCenter`, and `LocationWithDistance` (extracted from `get-study.tool.ts`, no behavior change). ([#84](https://github.com/cyanheads/clinicaltrialsgov-mcp-server/issues/84))
- **`get_field_values` `multiValued` flag** — array-typed fields (e.g. `Phase`, `Condition`) carry `multiValued: true` plus a `format()` note, since one study can hold several values and the per-value `studiesCount` buckets sum above the study total. Derived from the `/studies/metadata` node `type` ending in `[]`, looked up against the already-cached field index (no extra round-trip). ([#85](https://github.com/cyanheads/clinicaltrialsgov-mcp-server/issues/85))

## Fixed

- **`search_studies` / `get_study_count` query parse errors** no longer leak the upstream Essie/ANTLR grammar dump. The catch-all for `Error parsing query in …` now extracts the offending token from the `mismatched input 'X'`, `no viable alternative at input 'X'`, and `missing 'X' at …` shapes and produces a concise message (e.g. naming the reserved `[` / `]` characters), dropping the 22-token `expecting {…}` list while keeping the existing recovery hint. Covers every free-text param and `advancedFilter`. ([#83](https://github.com/cyanheads/clinicaltrialsgov-mcp-server/issues/83))
