clinicaltrialsgov-mcp-server 2.8.6 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +4 -3
  2. package/dist/mcp-server/resources/definitions/study.resource.d.ts +29 -2
  3. package/dist/mcp-server/resources/definitions/study.resource.d.ts.map +1 -1
  4. package/dist/mcp-server/resources/definitions/study.resource.js +122 -5
  5. package/dist/mcp-server/resources/definitions/study.resource.js.map +1 -1
  6. package/dist/mcp-server/tools/definitions/find-eligible.tool.d.ts +1 -0
  7. package/dist/mcp-server/tools/definitions/find-eligible.tool.d.ts.map +1 -1
  8. package/dist/mcp-server/tools/definitions/find-eligible.tool.js +155 -30
  9. package/dist/mcp-server/tools/definitions/find-eligible.tool.js.map +1 -1
  10. package/dist/mcp-server/tools/definitions/get-field-values.tool.d.ts +5 -0
  11. package/dist/mcp-server/tools/definitions/get-field-values.tool.d.ts.map +1 -1
  12. package/dist/mcp-server/tools/definitions/get-field-values.tool.js +23 -8
  13. package/dist/mcp-server/tools/definitions/get-field-values.tool.js.map +1 -1
  14. package/dist/mcp-server/tools/definitions/get-study-count.tool.js +9 -9
  15. package/dist/mcp-server/tools/definitions/get-study-count.tool.js.map +1 -1
  16. package/dist/mcp-server/tools/definitions/get-study-results.tool.d.ts +10 -0
  17. package/dist/mcp-server/tools/definitions/get-study-results.tool.d.ts.map +1 -1
  18. package/dist/mcp-server/tools/definitions/get-study-results.tool.js +152 -15
  19. package/dist/mcp-server/tools/definitions/get-study-results.tool.js.map +1 -1
  20. package/dist/mcp-server/tools/definitions/get-study.tool.d.ts.map +1 -1
  21. package/dist/mcp-server/tools/definitions/get-study.tool.js +1 -112
  22. package/dist/mcp-server/tools/definitions/get-study.tool.js.map +1 -1
  23. package/dist/mcp-server/tools/definitions/search-studies.tool.d.ts.map +1 -1
  24. package/dist/mcp-server/tools/definitions/search-studies.tool.js +36 -22
  25. package/dist/mcp-server/tools/definitions/search-studies.tool.js.map +1 -1
  26. package/dist/mcp-server/tools/utils/format-helpers.d.ts.map +1 -1
  27. package/dist/mcp-server/tools/utils/format-helpers.js +88 -12
  28. package/dist/mcp-server/tools/utils/format-helpers.js.map +1 -1
  29. package/dist/mcp-server/tools/utils/study-filters.d.ts +61 -0
  30. package/dist/mcp-server/tools/utils/study-filters.d.ts.map +1 -0
  31. package/dist/mcp-server/tools/utils/study-filters.js +120 -0
  32. package/dist/mcp-server/tools/utils/study-filters.js.map +1 -0
  33. package/dist/services/clinical-trials/clinical-trials-service.d.ts +30 -0
  34. package/dist/services/clinical-trials/clinical-trials-service.d.ts.map +1 -1
  35. package/dist/services/clinical-trials/clinical-trials-service.js +138 -2
  36. package/dist/services/clinical-trials/clinical-trials-service.js.map +1 -1
  37. package/package.json +1 -1
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  <div align="center">
9
9
 
10
- [![npm](https://img.shields.io/npm/v/clinicaltrialsgov-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/clinicaltrialsgov-mcp-server) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/clinicaltrialsgov-mcp-server) [![Version](https://img.shields.io/badge/Version-2.8.6-blue.svg?style=flat-square)](./CHANGELOG.md) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.29.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.14-blueviolet.svg?style=flat-square)](https://bun.sh/)
10
+ [![npm](https://img.shields.io/npm/v/clinicaltrialsgov-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/clinicaltrialsgov-mcp-server) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/clinicaltrialsgov-mcp-server) [![Version](https://img.shields.io/badge/Version-2.9.0-blue.svg?style=flat-square)](./CHANGELOG.md) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.29.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.14-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
11
 
12
12
  </div>
13
13
 
@@ -38,12 +38,12 @@ Seven tools for searching, discovering, analyzing, and matching clinical trials:
38
38
  | `clinicaltrials_get_study_count` | Get total study count for a query without fetching data. Fast statistics and breakdowns. |
39
39
  | `clinicaltrials_get_field_values` | Discover valid values for API fields (status, phase, study type, etc.) with per-value counts. |
40
40
  | `clinicaltrials_get_field_definitions` | Browse the study data model field tree — piece names, types, nesting. Supports subtree navigation and keyword search. |
41
- | `clinicaltrials_get_study_results` | Extract outcomes, adverse events, participant flow, and baseline from completed studies. Optional summary mode reduces ~200KB payloads to ~5KB. |
41
+ | `clinicaltrials_get_study_results` | Extract outcomes, adverse events, participant flow, and baseline from completed studies. Optional summary mode reduces ~200KB payloads to ~5KB; `outcomeLimit` / `adverseEventLimit` cap full mode without leaving it. |
42
42
  | `clinicaltrials_find_eligible` | Match patient demographics and conditions to eligible recruiting trials. Provide age, sex, conditions, and location to find studies with matching eligibility criteria, contacts, and recruiting locations. |
43
43
 
44
44
  | Resource | Description |
45
45
  | :------------------------- | :-------------------------------------------------- |
46
- | `clinicaltrials://{nctId}` | Fetch a single clinical trial study by NCT ID. Full JSON. |
46
+ | `clinicaltrials://{nctId}` | Fetch a single clinical trial study by NCT ID. Protocol JSON with capped locations/outcomes/references and results replaced by counts; omissions reported with the tool that retrieves them. |
47
47
 
48
48
  | Prompt | Description |
49
49
  | :------------------------ | :--------------------------------------------------------------------------------- |
@@ -84,6 +84,7 @@ Match a patient profile to eligible recruiting trials.
84
84
  - Builds optimized API queries with demographic filters (age range, sex, healthy volunteers)
85
85
  - Re-ranks results so studies whose own condition matches a requested condition surface above tangential matches from the upstream fuzzy condition search
86
86
  - Returns studies with eligibility and location fields for the caller to evaluate
87
+ - Bounds each candidate to the sites matching the requested location (capped by `locationLimit`) rather than every site the study registers worldwide, adds the nearest recruiting site when none of the matched ones is open, and discloses what was omitted
87
88
  - Provides actionable hints when no studies match (broaden conditions, adjust filters)
88
89
 
89
90
  ## Features
@@ -1,12 +1,39 @@
1
1
  /**
2
- * @fileoverview Single clinical study resource by NCT ID.
2
+ * @fileoverview Single clinical study resource by NCT ID, bounded to a size a
3
+ * client can hold. A resource read takes no arguments, so the caps are fixed
4
+ * server-side and every omission is disclosed with the tool that retrieves it.
3
5
  * @module mcp-server/resources/definitions/study.resource
4
6
  */
5
7
  import { z } from '@cyanheads/mcp-ts-core';
6
8
  import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
9
  export declare const studyResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{
8
10
  nctId: z.ZodString;
9
- }, z.core.$strip>, undefined, readonly [{
11
+ }, z.core.$strip>, z.ZodObject<{
12
+ nctId: z.ZodString;
13
+ study: z.ZodRecord<z.ZodString, z.ZodUnknown>;
14
+ resultsSummary: z.ZodOptional<z.ZodObject<{
15
+ outcomeMeasures: z.ZodOptional<z.ZodNumber>;
16
+ seriousAdverseEvents: z.ZodOptional<z.ZodNumber>;
17
+ otherAdverseEvents: z.ZodOptional<z.ZodNumber>;
18
+ participantFlowPeriods: z.ZodOptional<z.ZodNumber>;
19
+ baselineMeasures: z.ZodOptional<z.ZodNumber>;
20
+ }, z.core.$strip>>;
21
+ filtersApplied: z.ZodObject<{
22
+ totalLocations: z.ZodOptional<z.ZodNumber>;
23
+ locationLimit: z.ZodOptional<z.ZodNumber>;
24
+ totalSecondaryOutcomes: z.ZodOptional<z.ZodNumber>;
25
+ totalOtherOutcomes: z.ZodOptional<z.ZodNumber>;
26
+ totalReferences: z.ZodOptional<z.ZodNumber>;
27
+ outcomeLimit: z.ZodOptional<z.ZodNumber>;
28
+ referenceLimit: z.ZodOptional<z.ZodNumber>;
29
+ }, z.core.$strip>;
30
+ truncated: z.ZodBoolean;
31
+ retrieval: z.ZodOptional<z.ZodObject<{
32
+ nctId: z.ZodString;
33
+ studyRecordTool: z.ZodString;
34
+ studyResultsTool: z.ZodString;
35
+ }, z.core.$strip>>;
36
+ }, z.core.$strip>, readonly [{
10
37
  readonly reason: "study_not_found";
11
38
  readonly code: JsonRpcErrorCode.NotFound;
12
39
  readonly when: "The provided NCT ID does not match any study at ClinicalTrials.gov.";
@@ -1 +1 @@
1
- {"version":3,"file":"study.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/study.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAKjE,eAAO,MAAM,aAAa;;;;;;;;;;;;;GA6BxB,CAAC"}
1
+ {"version":3,"file":"study.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/study.resource.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAgBjE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsJxB,CAAC"}
@@ -1,5 +1,7 @@
1
1
  /**
2
- * @fileoverview Single clinical study resource by NCT ID.
2
+ * @fileoverview Single clinical study resource by NCT ID, bounded to a size a
3
+ * client can hold. A resource read takes no arguments, so the caps are fixed
4
+ * server-side and every omission is disclosed with the tool that retrieves it.
3
5
  * @module mcp-server/resources/definitions/study.resource
4
6
  */
5
7
  import { resource, z } from '@cyanheads/mcp-ts-core';
@@ -7,9 +9,18 @@ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
9
  import { getClinicalTrialsService } from '../../../services/clinical-trials/clinical-trials-service.js';
8
10
  import { nctIdSchema } from '../../tools/utils/_schemas.js';
9
11
  import { RECOVERY_HINTS } from '../../tools/utils/recovery-hints.js';
12
+ import { applyFilters, summarizeResults } from '../../tools/utils/study-filters.js';
13
+ /**
14
+ * Fixed cap on each of the study's three unbounded protocol lists — locations,
15
+ * secondary/other outcomes, references. Deliberately below the per-list maxima
16
+ * clinicaltrials_get_study_record accepts (500 / 100 / 100): that tool is the
17
+ * retrieval path for a caller who wants more, and it can be asked for the full
18
+ * list. A read of this resource cannot.
19
+ */
20
+ const LIST_LIMIT = 50;
10
21
  export const studyResource = resource('clinicaltrials://{nctId}', {
11
22
  name: 'Clinical Trial Study',
12
- description: 'Fetch a single clinical study by NCT ID. Returns full study data as JSON.',
23
+ description: `Fetch a single clinical study by NCT ID as JSON. The protocol record comes back whole apart from three capped lists (locations, secondary/other outcomes, references — ${LIST_LIMIT} each), and the results data, which reaches ~600KB on a large trial, is replaced by its counts. Anything omitted is reported in truncated, filtersApplied, and resultsSummary, with the tool that retrieves it named in retrieval.`,
13
24
  mimeType: 'application/json',
14
25
  errors: [
15
26
  {
@@ -29,11 +40,117 @@ export const studyResource = resource('clinicaltrials://{nctId}', {
29
40
  params: z.object({
30
41
  nctId: nctIdSchema.describe('NCT identifier (e.g., NCT03722472).'),
31
42
  }),
43
+ output: z.object({
44
+ nctId: z.string().describe('NCT identifier of the study read.'),
45
+ study: z
46
+ .record(z.string(), z.unknown())
47
+ .describe('The study record with the caps below already applied. Top-level keys: protocolSection (identification, status, sponsor, conditions, design, arms/interventions, outcomes, eligibility, contacts/locations), derivedSection (MeSH-normalized terms), documentSection, hasResults. resultsSection is omitted — see resultsSummary.'),
48
+ resultsSummary: z
49
+ .object({
50
+ outcomeMeasures: z.number().int().optional().describe('Posted outcome measures.'),
51
+ seriousAdverseEvents: z
52
+ .number()
53
+ .int()
54
+ .optional()
55
+ .describe('Distinct serious adverse-event terms.'),
56
+ otherAdverseEvents: z
57
+ .number()
58
+ .int()
59
+ .optional()
60
+ .describe('Distinct other (non-serious) adverse-event terms.'),
61
+ participantFlowPeriods: z.number().int().optional().describe('Participant-flow periods.'),
62
+ baselineMeasures: z.number().int().optional().describe('Baseline characteristic measures.'),
63
+ })
64
+ .optional()
65
+ .describe('Counts of the posted results data omitted from study, present when the study has results to count. Fetch the data itself with clinicaltrials_get_study_results.'),
66
+ filtersApplied: z
67
+ .object({
68
+ totalLocations: z
69
+ .number()
70
+ .int()
71
+ .optional()
72
+ .describe('Upstream location count before the cap trimmed the list.'),
73
+ locationLimit: z
74
+ .number()
75
+ .int()
76
+ .optional()
77
+ .describe('The location cap — present only when it trimmed the list.'),
78
+ totalSecondaryOutcomes: z
79
+ .number()
80
+ .int()
81
+ .optional()
82
+ .describe('Upstream secondary outcomes count before the cap trimmed the list.'),
83
+ totalOtherOutcomes: z
84
+ .number()
85
+ .int()
86
+ .optional()
87
+ .describe('Upstream other outcomes count before the cap trimmed the list.'),
88
+ totalReferences: z
89
+ .number()
90
+ .int()
91
+ .optional()
92
+ .describe('Upstream reference count before the cap trimmed the list.'),
93
+ outcomeLimit: z
94
+ .number()
95
+ .int()
96
+ .optional()
97
+ .describe('The outcome cap — present only when it trimmed a list.'),
98
+ referenceLimit: z
99
+ .number()
100
+ .int()
101
+ .optional()
102
+ .describe('The reference cap — present only when it trimmed the list.'),
103
+ })
104
+ .describe('Which caps trimmed a list, with the upstream total for each. Empty when every list came back whole. Primary outcomes and seeAlsoLinks are never capped.'),
105
+ truncated: z
106
+ .boolean()
107
+ .describe('True when results data or any capped list was omitted from study.'),
108
+ retrieval: z
109
+ .object({
110
+ nctId: z.string().describe('NCT identifier to pass to either tool.'),
111
+ studyRecordTool: z
112
+ .string()
113
+ .describe('Tool that returns the protocol record with caller-controlled locationLimit / outcomeLimit / referenceLimit — omit them for the uncapped lists.'),
114
+ studyResultsTool: z
115
+ .string()
116
+ .describe('Tool that returns the omitted results data, by section and with its own outcomeLimit / adverseEventLimit caps.'),
117
+ })
118
+ .optional()
119
+ .describe('How to retrieve what was omitted. Present only when truncated is true.'),
120
+ }),
32
121
  async handler(params, ctx) {
33
122
  const service = getClinicalTrialsService();
34
- const study = await service.getStudy(params.nctId, ctx);
35
- ctx.log.info('Study fetched', { nctId: params.nctId });
36
- return study;
123
+ const raw = (await service.getStudy(params.nctId, ctx));
124
+ const { study, meta } = applyFilters(raw, {
125
+ locationLimit: LIST_LIMIT,
126
+ outcomeLimit: LIST_LIMIT,
127
+ referenceLimit: LIST_LIMIT,
128
+ });
129
+ // The results data is the tail that overflows a context window — a large
130
+ // trial carries ~600KB of it against ~70KB of protocol. Carry its counts
131
+ // and point at the tool that fetches it section by section.
132
+ const resultsSummary = summarizeResults(study);
133
+ const droppedResults = study.resultsSection != null;
134
+ const studyOut = { ...study };
135
+ delete studyOut.resultsSection;
136
+ const truncated = droppedResults || Object.keys(meta).length > 0;
137
+ ctx.log.info('Study fetched', { nctId: params.nctId, truncated });
138
+ return {
139
+ nctId: params.nctId,
140
+ study: studyOut,
141
+ ...(resultsSummary ? { resultsSummary } : {}),
142
+ filtersApplied: meta,
143
+ truncated,
144
+ ...(truncated
145
+ ? {
146
+ retrieval: {
147
+ nctId: params.nctId,
148
+ studyRecordTool: 'clinicaltrials_get_study_record',
149
+ studyResultsTool: 'clinicaltrials_get_study_results',
150
+ },
151
+ }
152
+ : {}),
153
+ };
37
154
  },
38
155
  });
39
156
  //# sourceMappingURL=study.resource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"study.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/study.resource.ts"],"names":[],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 {"version":3,"file":"study.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/study.resource.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AAEjG,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEpF;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,0BAA0B,EAAE;IAChE,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,0KAA0K,UAAU,oOAAoO;IACra,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE;QACN;YACE,MAAM,EAAE,iBAAiB;YACzB,IAAI,EAAE,gBAAgB,CAAC,QAAQ;YAC/B,IAAI,EAAE,qEAAqE;YAC3E,QAAQ,EAAE,cAAc,CAAC,eAAe;SACzC;QACD;YACE,MAAM,EAAE,cAAc;YACtB,IAAI,EAAE,gBAAgB,CAAC,WAAW;YAClC,IAAI,EAAE,+DAA+D;YACrE,QAAQ,EAAE,cAAc,CAAC,YAAY;YACrC,SAAS,EAAE,IAAI;SAChB;KACF;IACD,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC,qCAAqC,CAAC;KACnE,CAAC;IAEF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;QAC/D,KAAK,EAAE,CAAC;a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H,yEAAyE;QACzE,yEAAyE;QACzE,4DAA4D;QAC5D,MAAM,cAAc,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC/C,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC;QACpD,MAAM,QAAQ,GAA4B,EAAE,GAAG,KAAK,EAAE,CAAC;QACvD,OAAO,QAAQ,CAAC,cAAc,CAAC;QAE/B,MAAM,SAAS,GAAG,cAAc,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QACjE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAElE,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,KAAK,EAAE,QAAQ;YACf,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7C,cAAc,EAAE,IAAI;YACpB,SAAS;YACT,GAAG,CAAC,SAAS;gBACX,CAAC,CAAC;oBACE,SAAS,EAAE;wBACT,KAAK,EAAE,MAAM,CAAC,KAAK;wBACnB,eAAe,EAAE,iCAAiC;wBAClD,gBAAgB,EAAE,kCAAkC;qBACrD;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -45,6 +45,7 @@ export declare const findEligible: import("@cyanheads/mcp-ts-core").ToolDefiniti
45
45
  healthyVolunteer: z.ZodDefault<z.ZodBoolean>;
46
46
  recruitingOnly: z.ZodDefault<z.ZodBoolean>;
47
47
  maxResults: z.ZodDefault<z.ZodNumber>;
48
+ locationLimit: z.ZodDefault<z.ZodNumber>;
48
49
  }, z.core.$strip>, z.ZodObject<{
49
50
  studies: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
50
51
  totalCount: z.ZodOptional<z.ZodNumber>;
@@ -1 +1 @@
1
- {"version":3,"file":"find-eligible.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/find-eligible.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAuDjE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAiC1F;AAwCD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAidvB,CAAC"}
1
+ {"version":3,"file":"find-eligible.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/find-eligible.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAgJjE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAiC1F;AA2CD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4gBvB,CAAC"}
@@ -9,11 +9,11 @@ import { formatRemainingStudyFields } from '../utils/format-helpers.js';
9
9
  import { blankValueMessage, firstBlankListParam, firstBlankParam } from '../utils/query-helpers.js';
10
10
  import { RECOVERY_HINTS } from '../utils/recovery-hints.js';
11
11
  /**
12
- * Score a study location against the user's stated location. Higher = better
13
- * match. City equality dominates, then state, then country; recruiting status
14
- * breaks ties between geographically-equivalent sites.
12
+ * How closely a site's geography matches the user's stated location. City
13
+ * equality dominates, then state, then country, so the score doubles as a match
14
+ * tier: every site sharing the study's best score matched at the same level.
15
15
  */
16
- function locationMatchScore(loc, user) {
16
+ function locationGeoScore(loc, user) {
17
17
  const eq = (a, b) => a !== undefined && b !== undefined && a.toLowerCase() === b.toLowerCase();
18
18
  let score = 0;
19
19
  if (eq(loc.city, user.city))
@@ -22,10 +22,79 @@ function locationMatchScore(loc, user) {
22
22
  score += 2;
23
23
  if (eq(loc.country, user.country))
24
24
  score += 1;
25
- if (loc.status === 'RECRUITING')
26
- score += 0.5;
27
25
  return score;
28
26
  }
27
+ /**
28
+ * Whether a site can enroll a patient who is searching for a trial. Only
29
+ * `RECRUITING` qualifies: `ENROLLING_BY_INVITATION` admits invited participants
30
+ * only, `NOT_YET_RECRUITING` has not opened, and the remaining statuses
31
+ * (`ACTIVE_NOT_RECRUITING`, `SUSPENDED`, `WITHDRAWN`, `TERMINATED`,
32
+ * `COMPLETED`) are closed. Same definition the study-level `recruitingOnly`
33
+ * filter applies upstream.
34
+ */
35
+ function isRecruiting(loc) {
36
+ return loc.status === 'RECRUITING';
37
+ }
38
+ /**
39
+ * Score a study location against the user's stated location. Higher = better
40
+ * match. Geography dominates; recruiting status breaks ties between
41
+ * geographically-equivalent sites.
42
+ */
43
+ function locationMatchScore(loc, user) {
44
+ return locationGeoScore(loc, user) + (isRecruiting(loc) ? 0.5 : 0);
45
+ }
46
+ /**
47
+ * Bound a candidate's site list to the sites that answer the caller's question.
48
+ *
49
+ * A location-constrained eligibility query qualifies a *study*, but the study
50
+ * still carries every site it has ever registered — hundreds of them, dominating
51
+ * both the payload and the answer with sites nowhere near the patient. Keep the
52
+ * sites that matched at the narrowest level the caller's location reached (city,
53
+ * else state, else country), then cap what survives.
54
+ *
55
+ * Geography alone decides the tier, so a tier can hold nothing but closed sites
56
+ * while the study's one open site sits further out — a patient-matching answer
57
+ * whose every shown site can enroll no one (#114). When that happens, admit the
58
+ * nearest recruiting site alongside the tier. Admitting one site keeps the
59
+ * local answer local; widening to that site's whole tier would trade a
60
+ * city-precise answer for a statewide dump and reinflate the payload this bound
61
+ * exists to hold down.
62
+ *
63
+ * The summary is returned only when the returned set is genuinely smaller than
64
+ * the upstream one — reporting a bound that dropped nothing would imply a filter
65
+ * ran where none did.
66
+ */
67
+ function boundLocations(sortedLocations, user, limit) {
68
+ const total = sortedLocations.length;
69
+ let best = 0;
70
+ for (const loc of sortedLocations)
71
+ best = Math.max(best, locationGeoScore(loc, user));
72
+ // best === 0 keeps every site: a study can qualify upstream on a facility or
73
+ // ZIP match with no city/state/country hit, and dropping all of its sites
74
+ // would answer with a candidate that appears to have nowhere to enroll.
75
+ const matched = sortedLocations.filter((loc) => locationGeoScore(loc, user) === best);
76
+ const capped = matched.slice(0, limit);
77
+ // sortedLocations runs best-match first, so the first recruiting site below
78
+ // the tier is the nearest one. Nothing is found when best === 0 (no site
79
+ // scores below it) or when the study registers no recruiting site at all —
80
+ // both leave the tier answer exactly as it was.
81
+ const admitted = capped.some(isRecruiting)
82
+ ? undefined
83
+ : sortedLocations.find((loc) => isRecruiting(loc) && locationGeoScore(loc, user) < best);
84
+ const locations = admitted ? [...capped, admitted] : capped;
85
+ if (locations.length === total)
86
+ return { locations };
87
+ return {
88
+ locations,
89
+ summary: {
90
+ totalLocations: total,
91
+ matchedLocations: matched.length,
92
+ locationsTruncated: matched.length > capped.length,
93
+ ...(admitted ? { nearestRecruitingSiteAdded: true } : {}),
94
+ retrieveFullStudyWith: 'clinicaltrials_get_study_record',
95
+ },
96
+ };
97
+ }
29
98
  /**
30
99
  * Generic condition tokens that carry no disease-specificity. Excluded from
31
100
  * token-overlap scoring so "Cardiovascular Disease" doesn't spuriously match
@@ -119,6 +188,9 @@ const ELIGIBLE_RENDERED = new Set([
119
188
  'protocolSection.descriptionModule.briefSummary',
120
189
  'protocolSection.eligibilityModule',
121
190
  'protocolSection.contactsLocationsModule',
191
+ // Rendered by the Sites line, not the field dump — otherwise it reads as a
192
+ // stray upstream field rather than the bound the handler applied.
193
+ 'locationSummary',
122
194
  ]);
123
195
  /** Fields requested for eligibility evaluation. */
124
196
  const ELIGIBLE_FIELDS = [
@@ -145,7 +217,7 @@ const ELIGIBLE_FIELDS = [
145
217
  'CentralContactEMail',
146
218
  ];
147
219
  export const findEligible = tool('clinicaltrials_find_eligible', {
148
- description: "Match patient demographics and conditions to eligible recruiting clinical trials. Provide age, sex, conditions, and location to find studies with matching eligibility criteria, contact information, and recruiting locations. Results are re-ranked so studies whose own condition matches a requested condition surface above tangential matches from ClinicalTrials.gov's fuzzy condition search.",
220
+ description: "Match patient demographics and conditions to eligible recruiting clinical trials. Provide age, sex, conditions, and location to find studies with matching eligibility criteria, contact information, and recruiting locations. Results are re-ranked so studies whose own condition matches a requested condition surface above tangential matches from ClinicalTrials.gov's fuzzy condition search. Each candidate returns only the sites matching the requested location (capped by locationLimit), not the study's full registered site list — a large trial can register hundreds of sites worldwide. When none of a candidate's matched sites is recruiting, its nearest recruiting site is added, so an enrollable site is never hidden behind a closer closed one. Fetch a study's complete record with clinicaltrials_get_study_record.",
149
221
  annotations: {
150
222
  readOnlyHint: true,
151
223
  idempotentHint: true,
@@ -173,7 +245,6 @@ export const findEligible = tool('clinicaltrials_find_eligible', {
173
245
  .describe("Patient's biological sex. Use 'ALL' to include studies regardless of sex restrictions."),
174
246
  conditions: z
175
247
  .array(z.string())
176
- .min(1)
177
248
  .describe('Medical conditions or diagnoses, e.g. ["Type 2 Diabetes", "Hypertension"]. Each entry is matched as a condition (multi-word entries match as a phrase); multiple entries are combined with OR, so studies for any listed condition qualify. Returned studies are re-ranked so those whose own condition list names a requested condition rank above tangential matches the upstream fuzzy search pulls in via the MeSH umbrella.'),
178
249
  location: z
179
250
  .object({
@@ -188,11 +259,18 @@ export const findEligible = tool('clinicaltrials_find_eligible', {
188
259
  .describe('Whether the patient is a healthy volunteer. When true, only studies accepting healthy volunteers are queried.'),
189
260
  recruitingOnly: z.boolean().default(true).describe('Only include actively recruiting studies.'),
190
261
  maxResults: z.number().int().min(1).max(50).default(10).describe('Maximum results to return.'),
262
+ locationLimit: z
263
+ .number()
264
+ .int()
265
+ .min(1)
266
+ .max(500)
267
+ .default(10)
268
+ .describe("Cap on the sites returned per candidate. Each candidate keeps only the sites matching the requested location at the narrowest level that matched (city, else state, else country), capped at this many; the rest of the study's registered sites are omitted. The cap governs those matched sites — when none of them is recruiting, the candidate's nearest recruiting site is added on top of it, so a candidate can carry one site more than this. Raise it to see more nearby sites, or fetch the complete site list with clinicaltrials_get_study_record. Each candidate reports totalLocations / matchedLocations / locationsTruncated / nearestRecruitingSiteAdded in locationSummary only when the bound actually dropped sites."),
191
269
  }),
192
270
  output: z.object({
193
271
  studies: z
194
272
  .array(z.record(z.string(), z.unknown()))
195
- .describe('Matching studies with eligibility and location fields.'),
273
+ .describe("Matching studies with eligibility and location fields. Each candidate's protocolSection.contactsLocationsModule.locations is BOUNDED to the sites matching the requested location (capped at locationLimit) plus, when none of those is recruiting, the candidate's nearest recruiting site — not the study's full registered site list. A candidate whose sites were bounded also carries a top-level locationSummary object — { totalLocations, matchedLocations, locationsTruncated, nearestRecruitingSiteAdded?, retrieveFullStudyWith } — absent when nothing was dropped; nearestRecruitingSiteAdded is present only when that extra site was added. Fetch a study's complete record and site list with clinicaltrials_get_study_record."),
196
274
  totalCount: z.number().optional().describe('Total matching studies from the API.'),
197
275
  }),
198
276
  // Agent-facing context — search echo, funnel diagnostics, and no-match guidance.
@@ -296,9 +374,27 @@ export const findEligible = tool('clinicaltrials_find_eligible', {
296
374
  ].filter(Boolean);
297
375
  const locationQuery = locationParts.join(', ');
298
376
  const statusFilter = input.recruitingOnly ? ['RECRUITING'] : undefined;
377
+ /**
378
+ * Each age bound is ORed with its MISSING counterpart. An
379
+ * `AREA[Field]RANGE[…]` predicate matches only studies that publish that
380
+ * field, so a closed range alone drops every study registered as "18 Years
381
+ * and older" — it carries a minimumAge and no maximumAge, the most
382
+ * permissive eligibility shape in the registry and the majority of
383
+ * recruiting trials. An absent bound is unbounded, not disqualifying.
384
+ *
385
+ * The widening cannot over-admit: `MISSING` and `RANGE[…]` are mutually
386
+ * exclusive on the same field (a study either publishes it or it doesn't),
387
+ * so a study admitted through the MISSING arm never had a declared bound to
388
+ * violate.
389
+ *
390
+ * Neither the Sex nor the HealthyVolunteers arm takes this treatment. An
391
+ * unrestricted study registers a literal `Sex: ALL` rather than omitting
392
+ * the field, and an unstated healthy-volunteer policy is not an
393
+ * affirmative yes.
394
+ */
299
395
  const advancedParts = [
300
- `AREA[MinimumAge]RANGE[MIN, ${input.age} years]`,
301
- `AREA[MaximumAge]RANGE[${input.age} years, MAX]`,
396
+ `(AREA[MinimumAge]RANGE[MIN, ${input.age} years] OR AREA[MinimumAge]MISSING)`,
397
+ `(AREA[MaximumAge]RANGE[${input.age} years, MAX] OR AREA[MaximumAge]MISSING)`,
302
398
  ];
303
399
  if (input.sex !== 'ALL') {
304
400
  advancedParts.push(`(AREA[Sex]ALL OR AREA[Sex]${input.sex})`);
@@ -368,16 +464,31 @@ export const findEligible = tool('clinicaltrials_find_eligible', {
368
464
  return (conditionMatchScore(bConds, input.conditions) -
369
465
  conditionMatchScore(aConds, input.conditions));
370
466
  });
371
- // Sort each study's locations by match to the user's input so the most
372
- // relevant sites surface first in both the structured payload and the
373
- // truncated format() rendering. Stable sort preserves upstream order for
374
- // sites with equal match scores.
375
- for (const study of result.studies) {
376
- const locs = study.protocolSection?.contactsLocationsModule?.locations;
377
- if (locs && locs.length > 1) {
378
- locs.sort((a, b) => locationMatchScore(b, input.location) - locationMatchScore(a, input.location));
379
- }
380
- }
467
+ // Sort each study's locations by match to the user's input, then bound the
468
+ // list to the sites that answer the question. A location-constrained query
469
+ // qualifies a study, but the study carries every site it ever registered —
470
+ // one candidate can publish 963 sites against 6 near the patient, which
471
+ // buries the answer and dominates the payload. The bound is applied here,
472
+ // once, before either output channel sees the record, so structuredContent
473
+ // and format() render the same sites (#46, #91). Stable sort preserves
474
+ // upstream order for sites with equal match scores.
475
+ const studies = result.studies.map((study) => {
476
+ const raw = study;
477
+ const locationsModule = raw.protocolSection?.contactsLocationsModule;
478
+ const upstream = locationsModule?.locations;
479
+ if (!upstream?.length)
480
+ return study;
481
+ const sorted = [...upstream].sort((a, b) => locationMatchScore(b, input.location) - locationMatchScore(a, input.location));
482
+ const { locations, summary } = boundLocations(sorted, input.location, input.locationLimit);
483
+ return {
484
+ ...study,
485
+ protocolSection: {
486
+ ...raw.protocolSection,
487
+ contactsLocationsModule: { ...locationsModule, locations },
488
+ },
489
+ ...(summary ? { locationSummary: summary } : {}),
490
+ };
491
+ });
381
492
  const conditionMatched = conditionStage.totalCount ?? 0;
382
493
  const locationMatched = locationStage.totalCount ?? 0;
383
494
  const demographicsMatched = result.totalCount ?? 0;
@@ -432,7 +543,7 @@ export const findEligible = tool('clinicaltrials_find_eligible', {
432
543
  ctx.enrich.notice(noticeParts.join(' '));
433
544
  }
434
545
  return {
435
- studies: result.studies,
546
+ studies,
436
547
  totalCount: result.totalCount,
437
548
  };
438
549
  },
@@ -500,14 +611,28 @@ export const findEligible = tool('clinicaltrials_find_eligible', {
500
611
  eligParts.push(`Healthy Volunteers: ${elig.healthyVolunteers ? 'Yes' : 'No'}`);
501
612
  if (eligParts.length)
502
613
  lines.push(` Eligibility: ${eligParts.join(' | ')}`);
503
- // Locations are pre-sorted by match-score in the handler, so the most
504
- // relevant sites (typically the user's city/state) lead. Render every
505
- // site — structuredContent carries the full list, so a first-3 preview
506
- // with a "(+N more)" tail left content-only clients unable to see the
507
- // remaining sites (#91). Each site's own status rides along: the tool
508
- // requests LocationStatus and returns it in structuredContent, and a
509
- // site-level status can differ from the study's overall status, so
510
- // omitting it made a NOT_YET_RECRUITING site read as currently open (#91).
614
+ // Disclose the bound the handler applied, so a content[]-only reader knows
615
+ // the site list is the near-the-patient subset rather than the full one,
616
+ // and knows how to reach the rest. Every locationSummary value renders
617
+ // here — absent from the record means nothing was dropped (#80).
618
+ const locationSummary = study.locationSummary;
619
+ if (locationSummary) {
620
+ const truncated = locationSummary.locationsTruncated ? ', list truncated' : '';
621
+ const admitted = locationSummary.nearestRecruitingSiteAdded
622
+ ? '; none of them is recruiting, so the nearest recruiting site is included'
623
+ : '';
624
+ lines.push(` Sites: showing ${locs.length} of ${locationSummary.totalLocations} registered (${locationSummary.matchedLocations} match the requested location${truncated}${admitted}). Full site list: ${locationSummary.retrieveFullStudyWith} with ${nctId}.`);
625
+ }
626
+ // Locations are sorted by match-score and bounded in the handler, so the
627
+ // most relevant sites (typically the user's city/state) lead. Render
628
+ // every site the record carries — a first-3 preview with a "(+N more)"
629
+ // tail left content-only clients unable to see the rest (#91), and the
630
+ // bound itself belongs at the handler boundary where both channels see
631
+ // it, never in one channel's formatter (#46). Each site's own status
632
+ // rides along: the tool requests LocationStatus and returns it in
633
+ // structuredContent, and a site-level status can differ from the study's
634
+ // overall status, so omitting it made a NOT_YET_RECRUITING site read as
635
+ // currently open (#91).
511
636
  if (locs.length > 0) {
512
637
  const locStr = locs
513
638
  .map((l) => {
@@ -1 +1 @@
1
- {"version":3,"file":"find-eligible.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/find-eligible.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AAEjG,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACpG,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAQ5D;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,GAAkB,EAAE,IAAkB;IAChE,MAAM,EAAE,GAAG,CAAC,CAAU,EAAE,CAAU,EAAE,EAAE,C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AAE,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;yBACjE,IAAI,CAAC,KAAK,CAAC,CAAC;oBACf,KAAK,CAAC,IAAI,CAAC,cAAc,UAAU,EAAE,CAAC,CAAC;gBACzC,CAAC;gBACD,4EAA4E;gBAC5E,mFAAmF;gBACnF,KAAK,CAAC,IAAI,CACR,GAAG,0BAA0B,CAAC,KAAgC,EAAE,iBAAiB,EAAE;oBACjF,QAAQ,EAAE,MAAM,CAAC,iBAAiB;oBAClC,WAAW,EAAE,MAAM,CAAC,iBAAiB;iBACtC,CAAC,CACH,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"find-eligible.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/find-eligible.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AAEjG,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACpG,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAQ5D;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,GAAkB,EAAE,IAAkB;IAC9D,MAAM,EAAE,GAAG,CAAC,CAAU,EAAE,CAAU,EAAE,EAAE,CACpC,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,SAAS,IAAI,C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