evidence-mcp-dev 1.0.5 → 1.0.7
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.
- package/dist/index.js +127 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2638,8 +2638,8 @@ function walled(url, stage2, dir = FH_EVIDENCE_DIR) {
|
|
|
2638
2638
|
const h = host(url);
|
|
2639
2639
|
if (!h) return null;
|
|
2640
2640
|
const all = read(dir, h);
|
|
2641
|
-
const
|
|
2642
|
-
return
|
|
2641
|
+
const live3 = (r) => r && (r.streak >= WALL_STREAK || RULE.test(r.reason)) && daysSince(r.date) < settings().retry_after_days ? r : null;
|
|
2642
|
+
return live3(all[stage2] ?? all[legacy(stage2)]) ?? live3(all[pathKey(url, stage2)]);
|
|
2643
2643
|
}
|
|
2644
2644
|
function recordStage(url, stage2, ok, reason = "", dir = FH_EVIDENCE_DIR) {
|
|
2645
2645
|
const h = host(url);
|
|
@@ -3301,7 +3301,8 @@ var google = {
|
|
|
3301
3301
|
// AQ.: the newer AI Studio keys
|
|
3302
3302
|
modelPrefix: "gemini-",
|
|
3303
3303
|
matches: (host3) => host3 === "generativelanguage.googleapis.com",
|
|
3304
|
-
windowChars: () =>
|
|
3304
|
+
windowChars: () => 4e5,
|
|
3305
|
+
// as Perplexity hosted: 800,000-character windows went over a 262k-token limit there (dense papers, 1.7 characters a token)
|
|
3305
3306
|
request: ({ base_url, api_key, model, state, questions }) => ({
|
|
3306
3307
|
url: `${base_url}/v1beta/decisions`,
|
|
3307
3308
|
headers: { "content-type": "application/json", ...api_key ? { "x-goog-api-key": api_key } : {} },
|
|
@@ -3384,11 +3385,14 @@ var perplexity = {
|
|
|
3384
3385
|
keyPrefixes: ["pplx-"],
|
|
3385
3386
|
modelPrefix: "pplx-",
|
|
3386
3387
|
matches: (host3) => host3 === "api.perplexity.ai",
|
|
3387
|
-
// Hosted takes
|
|
3388
|
+
// Hosted takes 262,144 tokens in one request (a 50k-token paper in 2 s); the
|
|
3388
3389
|
// Mac app is limited to 32k and slows steeply beyond 25k, so it windows.
|
|
3390
|
+
// Hosted windows of 400,000 characters: a paper's Markdown ran as dense as 1.7
|
|
3391
|
+
// characters a token (tables, numbers) — 800,000-character windows went over
|
|
3392
|
+
// the limit, 367 claims on live 2026-11-11–16 ("requires 470509 tokens").
|
|
3389
3393
|
windowChars: (baseUrl) => {
|
|
3390
3394
|
try {
|
|
3391
|
-
return new URL(baseUrl).hostname === "api.perplexity.ai" ?
|
|
3395
|
+
return new URL(baseUrl).hostname === "api.perplexity.ai" ? 4e5 : 9e4;
|
|
3392
3396
|
} catch {
|
|
3393
3397
|
return 9e4;
|
|
3394
3398
|
}
|
|
@@ -3614,7 +3618,7 @@ function publish() {
|
|
|
3614
3618
|
}
|
|
3615
3619
|
|
|
3616
3620
|
// src/tools.ts
|
|
3617
|
-
import { existsSync as
|
|
3621
|
+
import { existsSync as existsSync15, readFileSync as readFileSync13 } from "fs";
|
|
3618
3622
|
import { z } from "zod";
|
|
3619
3623
|
|
|
3620
3624
|
// src/cascade.ts
|
|
@@ -5271,6 +5275,84 @@ async function searchArticles(raw, libraryDir = FH_EVIDENCE_DIR, fetchImpl = liv
|
|
|
5271
5275
|
return { ok: true, result, cached: false };
|
|
5272
5276
|
}
|
|
5273
5277
|
|
|
5278
|
+
// src/dailymedsearch.ts
|
|
5279
|
+
import { createHash as createHash6 } from "crypto";
|
|
5280
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync10, readFileSync as readFileSync11 } from "fs";
|
|
5281
|
+
import { dirname as dirname7 } from "path";
|
|
5282
|
+
var MAX_RESULTS3 = 100;
|
|
5283
|
+
var DEFAULT_RESULTS3 = 20;
|
|
5284
|
+
var COLUMNS3 = ["set_id", "title", "labeler", "published", "version", "level"];
|
|
5285
|
+
var API3 = "https://dailymed.nlm.nih.gov/dailymed/services/v2/spls.json";
|
|
5286
|
+
var MONTHS2 = { Jan: "01", Feb: "02", Mar: "03", Apr: "04", May: "05", Jun: "06", Jul: "07", Aug: "08", Sep: "09", Oct: "10", Nov: "11", Dec: "12" };
|
|
5287
|
+
function normalizeQuery3(q) {
|
|
5288
|
+
const drug_name = (q.drug_name ?? "").replace(/\s+/g, " ").trim();
|
|
5289
|
+
if (!drug_name) return { error: "empty drug_name" };
|
|
5290
|
+
const labeler = (q.labeler ?? "").replace(/\s+/g, " ").trim();
|
|
5291
|
+
const out = { drug_name, max_results: Math.min(MAX_RESULTS3, Math.max(1, Math.floor(q.max_results ?? DEFAULT_RESULTS3))) };
|
|
5292
|
+
if (labeler) out.labeler = labeler;
|
|
5293
|
+
return out;
|
|
5294
|
+
}
|
|
5295
|
+
var searchKey3 = (q) => createHash6("sha1").update(JSON.stringify(["dailymed", q.drug_name.toLowerCase(), (q.labeler ?? "").toLowerCase(), q.max_results])).digest("hex").slice(0, 16);
|
|
5296
|
+
function searchUrl2(q) {
|
|
5297
|
+
const u = new URL(API3);
|
|
5298
|
+
u.searchParams.set("drug_name", q.drug_name);
|
|
5299
|
+
if (q.labeler) u.searchParams.set("labeler", q.labeler);
|
|
5300
|
+
u.searchParams.set("pagesize", String(q.max_results));
|
|
5301
|
+
return u.toString();
|
|
5302
|
+
}
|
|
5303
|
+
var isoDate2 = (d) => {
|
|
5304
|
+
const m = /^([A-Z][a-z]{2}) (\d{1,2}), (\d{4})$/.exec(String(d ?? "").trim());
|
|
5305
|
+
return m && MONTHS2[m[1]] ? `${m[3]}-${MONTHS2[m[1]]}-${m[2].padStart(2, "0")}` : null;
|
|
5306
|
+
};
|
|
5307
|
+
function splitTitle(t) {
|
|
5308
|
+
const m = /^(.*?)\s*\[([^\]]+)\]\s*$/.exec(t.trim());
|
|
5309
|
+
return m ? [m[1], m[2]] : [t.trim(), null];
|
|
5310
|
+
}
|
|
5311
|
+
function levelOf2(setid, libraryDir) {
|
|
5312
|
+
const paths = entryPaths(libraryDir, "dailymed", setid);
|
|
5313
|
+
return entryExists(paths) ? String(readStatus(paths, emptyStatus(`dailymed:${setid}`, "dailymed", setid, libraryDir)).level) : null;
|
|
5314
|
+
}
|
|
5315
|
+
function parseSearch(json2, libraryDir) {
|
|
5316
|
+
const d = JSON.parse(json2);
|
|
5317
|
+
const rows = [];
|
|
5318
|
+
for (const x of d.data ?? []) {
|
|
5319
|
+
if (!x.setid) continue;
|
|
5320
|
+
const [title, labeler] = splitTitle(String(x.title ?? ""));
|
|
5321
|
+
rows.push([x.setid, title, labeler, isoDate2(x.published_date), typeof x.spl_version === "number" ? x.spl_version : null, levelOf2(x.setid, libraryDir)]);
|
|
5322
|
+
}
|
|
5323
|
+
return { total: Number(d.metadata?.total_elements ?? rows.length) || rows.length, rows };
|
|
5324
|
+
}
|
|
5325
|
+
var live2 = (url) => fetchText(url, { "User-Agent": LIBRARY_UA, Accept: "application/json" });
|
|
5326
|
+
async function searchLabels(raw, libraryDir = FH_EVIDENCE_DIR, fetchImpl = live2) {
|
|
5327
|
+
const q = normalizeQuery3(raw);
|
|
5328
|
+
if ("error" in q) return { ok: false, error: q.error };
|
|
5329
|
+
const file3 = searchFile(libraryDir, searchKey3(q));
|
|
5330
|
+
if (existsSync13(file3)) {
|
|
5331
|
+
try {
|
|
5332
|
+
const r = JSON.parse(readFileSync11(file3, "utf8"));
|
|
5333
|
+
if (daysSince(r.searched) < searchCacheDays()) return { ok: true, result: { ...r, rows: r.rows.map((row3) => {
|
|
5334
|
+
const c = [...row3];
|
|
5335
|
+
c[5] = levelOf2(row3[0], libraryDir);
|
|
5336
|
+
return c;
|
|
5337
|
+
}) }, cached: true };
|
|
5338
|
+
} catch {
|
|
5339
|
+
}
|
|
5340
|
+
}
|
|
5341
|
+
let parsed;
|
|
5342
|
+
try {
|
|
5343
|
+
parsed = parseSearch(await fetchImpl(searchUrl2(q)), libraryDir);
|
|
5344
|
+
} catch (e) {
|
|
5345
|
+
return { ok: false, error: `dailymed: ${e instanceof Error ? e.message : String(e)}` };
|
|
5346
|
+
}
|
|
5347
|
+
const result = { source: "dailymed", query: q, total: parsed.total, columns: COLUMNS3, rows: parsed.rows, searched: today() };
|
|
5348
|
+
try {
|
|
5349
|
+
mkdirSync10(dirname7(file3), { recursive: true });
|
|
5350
|
+
writeAtomic(file3, JSON.stringify(result, null, 2) + "\n");
|
|
5351
|
+
} catch {
|
|
5352
|
+
}
|
|
5353
|
+
return { ok: true, result, cached: false };
|
|
5354
|
+
}
|
|
5355
|
+
|
|
5274
5356
|
// src/trialrecord.ts
|
|
5275
5357
|
var list4 = (a) => Array.isArray(a) ? a : [];
|
|
5276
5358
|
var para2 = (s, max = Infinity) => {
|
|
@@ -5388,13 +5470,13 @@ function resultsText(nct, md, maxChars) {
|
|
|
5388
5470
|
}
|
|
5389
5471
|
|
|
5390
5472
|
// src/missing.ts
|
|
5391
|
-
import { existsSync as
|
|
5473
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync11, readFileSync as readFileSync12 } from "fs";
|
|
5392
5474
|
import { join as join12 } from "path";
|
|
5393
5475
|
var missingFile = (p) => join12(p.entryDir, `${p.entry}-missing.md`);
|
|
5394
5476
|
function readMissing(p) {
|
|
5395
5477
|
const f = missingFile(p);
|
|
5396
|
-
if (!
|
|
5397
|
-
const md =
|
|
5478
|
+
if (!existsSync14(f)) return null;
|
|
5479
|
+
const md = readFileSync12(f, "utf8");
|
|
5398
5480
|
const get4 = (k) => /^$/.test(k) ? "" : (new RegExp(`^${k}:[ \\t]*(.*)$`, "m").exec(md)?.[1] ?? "").trim();
|
|
5399
5481
|
const checked = get4("checked"), reason = get4("reason");
|
|
5400
5482
|
return checked ? { checked, reason: reason || "not found" } : null;
|
|
@@ -5405,7 +5487,7 @@ function freshMissing(p, retryDays) {
|
|
|
5405
5487
|
}
|
|
5406
5488
|
function rememberMissing(p, reason) {
|
|
5407
5489
|
const m = { checked: now(), reason };
|
|
5408
|
-
|
|
5490
|
+
mkdirSync11(p.entryDir, { recursive: true });
|
|
5409
5491
|
writeAtomic(missingFile(p), `checked: ${m.checked}
|
|
5410
5492
|
reason: ${m.reason}
|
|
5411
5493
|
`);
|
|
@@ -5415,7 +5497,7 @@ var missingNote = (m, retryDays) => `${m.reason} (checked ${m.checked.slice(0, 1
|
|
|
5415
5497
|
|
|
5416
5498
|
// src/pubmedbatch.ts
|
|
5417
5499
|
var MAX_PMIDS = 200;
|
|
5418
|
-
var
|
|
5500
|
+
var COLUMNS4 = ["pmid", "title", "first_author", "year", "publication_types", "retracted", "level"];
|
|
5419
5501
|
var EFETCH2 = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi";
|
|
5420
5502
|
function efetchBatchUrl(pmids) {
|
|
5421
5503
|
const u = new URL(EFETCH2);
|
|
@@ -5439,7 +5521,7 @@ function splitArticles(xml) {
|
|
|
5439
5521
|
}
|
|
5440
5522
|
var row2 = (pmid, s, level) => s ? [pmid, s.title ? s.title.replace(/\.$/, "") : s.title, s.first_author, s.year, reviewTypes(s.publication_types).join("; ") || null, s.retracted, level] : [pmid, null, null, null, null, null, level];
|
|
5441
5523
|
async function fetchArticles(ids, libraryDir = FH_EVIDENCE_DIR, converter = "evidence-mcp", fetchImpl = fetchText) {
|
|
5442
|
-
const result = { columns:
|
|
5524
|
+
const result = { columns: COLUMNS4, rows: [], new: 0, cached: 0, not_found: 0, invalid: 0, asked: 0 };
|
|
5443
5525
|
const order2 = [];
|
|
5444
5526
|
const invalid = /* @__PURE__ */ new Map();
|
|
5445
5527
|
for (const raw of ids.slice(0, MAX_PMIDS)) {
|
|
@@ -5501,7 +5583,7 @@ async function fetchArticles(ids, libraryDir = FH_EVIDENCE_DIR, converter = "evi
|
|
|
5501
5583
|
// src/tools.ts
|
|
5502
5584
|
var pkg = (() => {
|
|
5503
5585
|
try {
|
|
5504
|
-
return JSON.parse(
|
|
5586
|
+
return JSON.parse(readFileSync13(new URL("../package.json", import.meta.url), "utf8"));
|
|
5505
5587
|
} catch {
|
|
5506
5588
|
return { name: "evidence-mcp", version: "0.0.0" };
|
|
5507
5589
|
}
|
|
@@ -5511,7 +5593,7 @@ var INSTRUCTIONS = `evidence-mcp keeps a local library of scientific papers, FDA
|
|
|
5511
5593
|
IDs \u2014 always "type:value"
|
|
5512
5594
|
- pmid:30955454 \u2014 a paper by PubMed ID. Bare digits are taken as a PMID.
|
|
5513
5595
|
- doi:10.\u2026 \u2014 a paper by DOI. A DOI PubMed indexes is stored under its PMID; any other gets its record from Crossref.
|
|
5514
|
-
- dailymed:<set ID> \u2014 an FDA prescribing-information label, current version. The set ID is the "setid=" value in the label's DailyMed URL.
|
|
5596
|
+
- dailymed:<set ID> \u2014 an FDA prescribing-information label, current version. The set ID comes from fh_dailymed_search_labels, or is the "setid=" value in the label's DailyMed URL.
|
|
5515
5597
|
- nct:05173896 \u2014 a ClinicalTrials.gov trial record, current version. NCT05173896 is accepted too.
|
|
5516
5598
|
|
|
5517
5599
|
Tools
|
|
@@ -5523,6 +5605,7 @@ Tools
|
|
|
5523
5605
|
- fh_pubmed_fetch_articles(pmids) \u2014 title, first author, year, publication types, retracted and level for up to 200 PMIDs at once; faster and far smaller than asking PubMed, known papers from disk, the rest in one request and stored. For abstract or full text: fh_library_read.
|
|
5524
5606
|
- fh_pubmed_search_articles(query, max_results?, sort?, years?) \u2014 search PubMed in its own syntax: the total and rows in columns order (PMID, title, first author, year, journal, publication types, PMCID, library level); faster and far smaller than asking PubMed. Cached a week.
|
|
5525
5607
|
- fh_clinicaltrials_search_studies(query | intervention | condition, status?, sort?, max_results?) \u2014 search ClinicalTrials.gov: the total and rows in columns order (NCT ID, title, status, phase, enrollment, dates, primary outcome, conditions, interventions, has_results). Cached a week.
|
|
5608
|
+
- fh_dailymed_search_labels(drug_name, labeler?, max_results?) \u2014 find FDA drug labels by generic or brand name: the total and rows in columns order (set ID, title, labeler, published, version, level), newest first; labeler narrows to one company. Use it rather than DailyMed's search page, which shows no set IDs as Markdown. Cached a week.
|
|
5526
5609
|
- fh_clinicaltrials_get_study_record(nct) \u2014 one trial as a review needs it (status, design, enrollment, dates, outcomes, eligibility, result publications, summary), from the stored record; added first when missing.
|
|
5527
5610
|
- fh_clinicaltrials_get_study_results(nct, max_chars?) \u2014 a trial's posted results as Markdown, capped; the outcome titles listed for fh_library_read.
|
|
5528
5611
|
- fh_fetch_url(url, max_length?, start_index?, raw?, title_only?) \u2014 a web page as Markdown, same call and same answer as the standard fetch tool ("Contents of <url>:" and the page, cut at max_length with a note on how to continue). Prefer it for every URL: a cached page answers from disk, a walled or script-rendered page runs through the browser and unlocker stages in one call. PDFs as Markdown; XML, JSON and other text as is. title_only returns the title line alone \u2014 enough to verify a link, at a few tokens.
|
|
@@ -5896,8 +5979,8 @@ function registerTools(server2) {
|
|
|
5896
5979
|
}
|
|
5897
5980
|
added = true;
|
|
5898
5981
|
}
|
|
5899
|
-
const full =
|
|
5900
|
-
const md =
|
|
5982
|
+
const full = existsSync15(paths.fulltextMd);
|
|
5983
|
+
const md = readFileSync13(full ? paths.fulltextMd : paths.md, "utf8");
|
|
5901
5984
|
const text4 = full ? "full_text" : "abstract";
|
|
5902
5985
|
const base = added ? { requested: parsed.requested, entry: paths.entry, text: text4, added: true } : { requested: parsed.requested, entry: paths.entry, text: text4 };
|
|
5903
5986
|
const headings2 = () => outline(md, text4).sections;
|
|
@@ -5917,8 +6000,8 @@ function registerTools(server2) {
|
|
|
5917
6000
|
const cap = max_chars ?? 6e3;
|
|
5918
6001
|
let sec = readSection(md, section2, cap);
|
|
5919
6002
|
let via = "";
|
|
5920
|
-
if (!sec && /abstract/i.test(section2) && full &&
|
|
5921
|
-
sec = readSection(
|
|
6003
|
+
if (!sec && /abstract/i.test(section2) && full && existsSync15(paths.md)) {
|
|
6004
|
+
sec = readSection(readFileSync13(paths.md, "utf8"), "abstract", cap);
|
|
5922
6005
|
via = " (from the abstract file)";
|
|
5923
6006
|
}
|
|
5924
6007
|
if (!sec && /declaration/i.test(section2)) {
|
|
@@ -6047,8 +6130,8 @@ ${st.funding.map((f) => `- ${f}`).join("\n")}` : ""].filter(Boolean).join("\n\n"
|
|
|
6047
6130
|
return { content: [{ type: "text", text: `Failed to fetch ${url}: ${added.error}` }], isError: true };
|
|
6048
6131
|
}
|
|
6049
6132
|
}
|
|
6050
|
-
const file3 = pid.type === "pmid" ? paths.md :
|
|
6051
|
-
const md =
|
|
6133
|
+
const file3 = pid.type === "pmid" ? paths.md : existsSync15(paths.fulltextMd) ? paths.fulltextMd : paths.md;
|
|
6134
|
+
const md = existsSync15(file3) ? readFileSync13(file3, "utf8") : "";
|
|
6052
6135
|
const text4 = title_only ? `Contents of ${url}:
|
|
6053
6136
|
${(md.split("\n").find((l) => l.trim()) ?? "").trim()}` : fetchAnswer(url, md, "", max_length, start_index);
|
|
6054
6137
|
bump("fetch", had);
|
|
@@ -6132,6 +6215,28 @@ ${(md.split("\n").find((l) => l.trim()) ?? "").trim()}` : fetchAnswer(url, md, "
|
|
|
6132
6215
|
return { content: [{ type: "text", text: searchAnswer(r.result) }] };
|
|
6133
6216
|
}
|
|
6134
6217
|
);
|
|
6218
|
+
server2.tool(
|
|
6219
|
+
"fh_dailymed_search_labels",
|
|
6220
|
+
`Find FDA drug labels on DailyMed by drug name, generic or brand: the total and up to ${MAX_RESULTS3} rows as arrays in columns order \u2014 set ID, title (drug and form), labeler (the company), published date, version, and the library level when the label is already stored. Newest first. A generic name lists every maker's label; labeler narrows to one company ("Boehringer" for Micardis's maker), a brand name to its own labels. Pass the set ID as "dailymed:<set ID>" to fh_library_read or fh_library_add. Use this, not DailyMed's search page: fetched as Markdown the page shows no set IDs, raw it is some 150,000 characters. The same search is answered from disk for ${searchCacheDays()} days.`,
|
|
6221
|
+
{
|
|
6222
|
+
drug_name: z.string().describe('Generic or brand name: "telmisartan", "Micardis".'),
|
|
6223
|
+
labeler: z.string().optional().describe(`Part of the company's name, to narrow to its labels: "Boehringer".`),
|
|
6224
|
+
max_results: z.number().int().min(1).max(MAX_RESULTS3).default(20).describe("Rows to return (1\u2013100).")
|
|
6225
|
+
},
|
|
6226
|
+
async (args) => {
|
|
6227
|
+
const t0 = Date.now();
|
|
6228
|
+
const r = await searchLabels(args, FH_EVIDENCE_DIR);
|
|
6229
|
+
const secs = ((Date.now() - t0) / 1e3).toFixed(1).padStart(4, "0") + "s";
|
|
6230
|
+
if (!r.ok) {
|
|
6231
|
+
log("search", "dailymed", `error: ${r.error}`);
|
|
6232
|
+
return { content: [{ type: "text", text: compact2({ error: r.error }) }], isError: true };
|
|
6233
|
+
}
|
|
6234
|
+
bump("search", r.cached);
|
|
6235
|
+
const q = r.result.query;
|
|
6236
|
+
log("search", "dailymed", `ok ${r.cached ? "cached" : secs} rows=${r.result.rows.length} total=${r.result.total} | ${q.drug_name}${q.labeler ? ` labeler=${q.labeler}` : ""}`);
|
|
6237
|
+
return { content: [{ type: "text", text: searchAnswer(r.result) }] };
|
|
6238
|
+
}
|
|
6239
|
+
);
|
|
6135
6240
|
const nctEntry = async (id) => {
|
|
6136
6241
|
const p = parseId(/^\d{8}$/.test(id.trim()) ? `nct:${id.trim()}` : id);
|
|
6137
6242
|
if (p.error) return { error: p.error };
|
|
@@ -6157,7 +6262,7 @@ ${(md.split("\n").find((l) => l.trim()) ?? "").trim()}` : fetchAnswer(url, md, "
|
|
|
6157
6262
|
return { content: [{ type: "text", text: compact2({ error: e.error }) }], isError: true };
|
|
6158
6263
|
}
|
|
6159
6264
|
const raw = e.paths.fulltextRaw("json");
|
|
6160
|
-
const r =
|
|
6265
|
+
const r = existsSync15(raw) ? recordSummary(readFileSync13(raw, "utf8")) : null;
|
|
6161
6266
|
if (!r) {
|
|
6162
6267
|
log("trials", e.requested, "record error: no stored record");
|
|
6163
6268
|
return { content: [{ type: "text", text: compact2({ error: "no stored record" }) }], isError: true };
|
|
@@ -6176,7 +6281,7 @@ ${(md.split("\n").find((l) => l.trim()) ?? "").trim()}` : fetchAnswer(url, md, "
|
|
|
6176
6281
|
log("trials", nct, `results error: ${e.error}`);
|
|
6177
6282
|
return { content: [{ type: "text", text: compact2({ error: e.error }) }], isError: true };
|
|
6178
6283
|
}
|
|
6179
|
-
const md =
|
|
6284
|
+
const md = existsSync15(e.paths.fulltextMd) ? readFileSync13(e.paths.fulltextMd, "utf8") : "";
|
|
6180
6285
|
const r = resultsText(e.requested.replace(/^nct:/, "NCT"), md, max_chars);
|
|
6181
6286
|
log("trials", e.requested, `results ${r.has_results ? `${r.outcomes.length} outcomes${r.truncated ? " truncated" : ""}` : "none"}`);
|
|
6182
6287
|
return { content: [{ type: "text", text: leanJson(r) }] };
|