| summary | Rewrite get_study_record format() for full coverage; harden retry/backoff; consolidate duplicated NCT ID regex |
|---|---|
| breaking | false |
clinicaltrials_get_study_recordrendering —format()previously emitted only a subset of the fields it fetched, so clients readingcontent[](e.g., Claude Desktop) never sawdetailedDescription,otherOutcomes, collaborators, keywords, secondary IDs, design info (allocation/model/purpose/masking), submission/update dates, oversight flags, IPD sharing, or references. Rewroteformat()to render every populated field; expandedRawStudyShapeto type them. Closes #18.- Silent object-array truncation in shared formatter —
collectLeavesinformat-helpers.tshard-capped object arrays at 3 items and emitted a misleading+N moresentinel. The outermaxLinesbudget already bounds total output; the per-array cap was redundant and silently dropped data for clients readingcontent[]. Removed the cap. Affectsclinicaltrials_search_studiesandclinicaltrials_find_eligible. Closes #19. - Retry logic hardening in
ClinicalTrialsService— RaisedMAX_RETRIESfrom 3 to 6, backoff cap from 8s to 30s, replaced fixed 0–500ms jitter with ±25% proportional jitter, and threw a distinctMcpError(JsonRpcErrorCode.RateLimited)on 429 exhaustion (previously lumped with 5xxServiceUnavailable). Added aClinicalTrialsServiceOptionsconstructor parameter for test-friendly overrides. Closes #20. clinicaltrials_get_study_counthint coupling —format()now iteratesresult.noMatchHintsinstead of hardcoding a fallback string, eliminating a latent divergence betweenstructuredContentandcontent[]. Closes #21.- Duplicated NCT ID regex — Consolidated the inline
/^NCT\d{8}$/pattern from six sites into a sharednctIdSchemaexport insrc/mcp-server/tools/utils/_schemas.ts. Two of the prior sites (get_study_recordinput,clinicaltrials://{nctId}resource params) were missing the canonical error message and now return "NCT IDs must match format NCTxxxxxxxx (8 digits)." consistently. Closes #22. clinicaltrials_get_study_resultsbatch error handling — When all submitted NCT IDs were rejected by the API (e.g., with 400 "incorrect format"),getStudiesBatchthrew out of the handler instead of populatingfetchErrors. Wrapped the batch call in a try/catch that maps the batch-wide failure into per-IDfetchErrorsentries, matching the partial-failure response shape. Removed the companionresults.length === 0 && fetchErrors.length > 0throw so the all-failed path stays graceful too. Closes #23.FieldValueStatstype/runtime divergence — MarkedtopValuesanduniqueValuesCountoptional onFieldValueStats; the API omits them for BOOLEAN fields (which returntrueCount/falseCountinstead), so the prior required-typed signature lied to TS callers. Also added an empty-topValues fallback inget_field_valuesformat()— it previously emitted no lines when the array was empty, silently hiding the field from the LLM. Closes #25.
src/mcp-server/tools/utils/_schemas.ts— New module exporting shared Zod schemas (starting withnctIdSchema).ClinicalTrialsServiceOptions— New exported interface onClinicalTrialsServicefor overriding retry/backoff behavior (maxRetries,baseBackoffMs,maxBackoffMs). Primarily used by tests.- Tests — Added
tests/mcp-server/tools/utils/format-helpers.test.tscovering primitive-array flattening, object-array traversal without truncation,maxLinesbudget,maxValueLentruncation, and structural path elision. Extended existing tests with regression cases for every fix above.
ClinicalTrialsServiceconstructor signature — Now accepts an optional secondClinicalTrialsServiceOptionsparameter. Callers using the one-arg form are unchanged.get_study_recordformat()output — Significantly richer. Header now includes**Official Title:**(when distinct frombriefTitle),**Org Study ID:**,**Organization:**,**Secondary IDs:**. New**Design:**,**Submission:**,**Collaborators:**,**Keywords:**,**Oversight:**lines in the metadata block. New## Detailed Description,## Other Outcomes,## IPD Sharing, and## Referencessections (each conditional on presence in the study).
- Upgraded
@cyanheads/mcp-ts-corefrom^0.4.1to^0.5.0. Adopted the newparseEnvConfighelper insrc/config/server-config.ts.
- Synced
maintenanceskill (1.2 → 1.3) from the framework package.