evidence-mcp-dev 1.0.30 → 1.0.31

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 (2) hide show
  1. package/dist/index.js +9 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7714,7 +7714,7 @@ var jobAnswer = (evid, j) => ({
7714
7714
  stage: j.stage,
7715
7715
  seconds: j.seconds,
7716
7716
  ...j.state === "running" ? { next: "the map is being built; read it with fh_evmap_get_map \u2014 it answers this state until the map is done (several minutes)" } : {},
7717
- ...j.state === "interrupted" ? { next: "the server that was building this map stopped; call fh_evmap_create_map again with this evid to go on (what was searched and screened is kept)" } : {},
7717
+ ...j.state === "interrupted" ? { next: "the server that was building this map stopped; call fh_evmap_create_map again with this evid with this evid to go on (what was searched and screened is kept)" } : {},
7718
7718
  ...j.state === "failed" ? { error: j.error } : {}
7719
7719
  });
7720
7720
 
@@ -7769,7 +7769,8 @@ function instead(map, pmid, item, kind) {
7769
7769
  for (const x of of) if (x.kind !== "review") score2.set(key2(x), (score2.get(key2(x)) ?? 0) + 5);
7770
7770
  }
7771
7771
  const out = [];
7772
- for (const [k] of [...score2].sort((a, b) => b[1] - a[1])) {
7772
+ const top = Math.max(0, ...score2.values());
7773
+ for (const [k] of [...score2].filter((x) => x[1] >= top).sort((a, b) => b[1] - a[1])) {
7773
7774
  const [kd, it] = k.split("\0");
7774
7775
  const articles = map.prepare("SELECT a.pmid, a.title, a.year, a.design FROM item_picks p JOIN articles a ON a.pmid = p.pmid WHERE p.kind = ? AND p.item = ? ORDER BY p.pick").all(kd, it).filter((a) => a.pmid !== pmid).map((a) => ({ ...a }));
7775
7776
  if (articles.length) out.push({ item: `${kd}: ${it}`, articles });
@@ -7792,7 +7793,7 @@ function reportGap(lib, r, now2 = /* @__PURE__ */ new Date()) {
7792
7793
  else {
7793
7794
  const has = !!map.prepare("SELECT name FROM sqlite_master WHERE name = 'query_items'").get();
7794
7795
  items = has ? query(map, `SELECT kind || ': ' || item FROM query_items ${r.kind ? "WHERE kind = ?" : ""} GROUP BY kind, item ORDER BY MIN(rowid)`, r.kind ? [r.kind] : [], 0, 500).rows.map((x) => String(x[0])) : [];
7795
- c = { class: "item", detail: has ? `the map has ${items.length} item${items.length === 1 ? "" : "s"}${r.kind ? ` of kind ${r.kind}` : ""}; whether one covers "${item}" under another name is in the list` : "this map has no items (it was built from a caller's own queries)" };
7796
+ c = { class: "item", detail: has ? `the map has ${items.length} item${items.length === 1 ? "" : "s"}${r.kind ? ` of kind ${r.kind}` : ""}; one may cover "${item}" under another name` : "this map has no items (it was built from a caller's own queries)" };
7796
7797
  }
7797
7798
  if (c.class !== "picked") alt = instead(map, pmid, item, r.kind);
7798
7799
  } finally {
@@ -7801,7 +7802,7 @@ function reportGap(lib, r, now2 = /* @__PURE__ */ new Date()) {
7801
7802
  const db = open(lib);
7802
7803
  try {
7803
7804
  const id = Number(db.prepare("INSERT INTO gaps (reported, host, evid, topic, pmid, item, kind, reason, class, detail) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(now2.toISOString(), HOST, o.evid, topic, pmid ?? null, item ?? null, r.kind ?? null, r.reason?.trim() || null, c.class, c.detail).id);
7804
- return { ok: true, id, class: c.class, detail: c.detail, ...items ? { items } : {}, ...alt.length ? { instead: alt } : {} };
7805
+ return { ok: true, id, class: c.class, detail: c.detail, ...items && !alt.length ? { items } : {}, ...alt.length ? { instead: alt } : {} };
7805
7806
  } finally {
7806
7807
  db.close();
7807
7808
  }
@@ -8479,7 +8480,7 @@ ${st.funding.map((f) => `- ${f}`).join("\n")}` : ""].filter(Boolean).join("\n\n"
8479
8480
  );
8480
8481
  server2.tool(
8481
8482
  "fh_info",
8482
- `The server and the whole library as JSON: this server's package name and version (which build is loaded), its log file; evidence directory (evidence_dir) and host; entry count and size on disk, by type and by level (by_type, by_level); per type (pmid, doi, dailymed, nct, url \u2014 pages stored by fh_fetch_url) the entries by level (full_text, abstract, title), retractions and fulltext_not_tried (articles stored from PubMed alone) (types); counts of retracted and not-citable entries and of errata, expressions of concern and updates (retracted, not_citable, errata, concerns, updates); the retrieval sources in run order and which are off (tiers); the multi-stage download (download): the Playwright servers with the version they must run, the Chrome stages, whether an unlocker is configured; the configuration and where each value came from \u2014 environment, .env or default, never the value (config); the decision model behind fh_verify_claim and whether it answers right now (verify);${evidEnabled() ? " the EVIDs and how many hold an evidence map (evid);" : ""}${evidenceMapEnabled() ? " the screening and re-ranking models of fh_evmap_create_map (evidence_map);" : ""}${webSearchConfigured() ? " the providers behind fh_web_search (web_search);" : ""} the unlockers and whether each answers right now (unlockers); our own stage hosts \u2014 fetch proxy, Playwright servers, Chrome \u2014 and whether each is reachable right now (stages); this server's cache hits and misses since it started (cache): verify (fh_verify_claim), fetch (fh_fetch_url), search (the search tools), pubmed (fh_pubmed_fetch_articles, per PMID).`,
8483
+ `The server and the whole library as JSON: this server's package name and version (which build is loaded), its log file; evidence directory (evidence_dir) and host; entry count and size on disk, by type and by level (by_type, by_level); per type (pmid, doi, dailymed, nct, url \u2014 pages stored by fh_fetch_url) the entries by level (full_text, abstract, title), retractions and fulltext_not_tried (articles stored from PubMed alone) (types); counts of retracted and not-citable entries and of errata, expressions of concern and updates (retracted, not_citable, errata, concerns, updates); the retrieval sources in run order and which are off (tiers); the multi-stage download (download): the Playwright servers with the version they must run, the Chrome stages, whether an unlocker is configured; the configuration and where each value came from \u2014 environment, .env or default, never the value (config); the decision model behind fh_verify_claim and whether it answers right now (verify);${evidEnabled() ? " how many EVIDs there are and how many hold an evidence map (evid: entries, evidence_maps);" : ""}${evidenceMapEnabled() ? " the discovery, screening and ranking models of fh_evmap_create_map and where its prompts come from (evidence_map);" : ""}${webSearchConfigured() ? " the providers behind fh_web_search (web_search);" : ""} the unlockers and whether each answers right now (unlockers); our own stage hosts \u2014 fetch proxy, Playwright servers, Chrome \u2014 and whether each is reachable right now (stages); this server's cache hits and misses since it started (cache): verify (fh_verify_claim), fetch (fh_fetch_url), search (the search tools), pubmed (fh_pubmed_fetch_articles, per PMID).`,
8483
8484
  {},
8484
8485
  async () => {
8485
8486
  const info = libraryInfo(FH_EVIDENCE_DIR, HOST);
@@ -8707,10 +8708,10 @@ Citations from OpenAlex. Cached ${searchCacheDays()} days.`,
8707
8708
  }
8708
8709
  if (evidenceMapEnabled()) server2.tool(
8709
8710
  "fh_evmap_create_map",
8710
- `Builds the evidence map of a topic: the PubMed articles a review needs, picked per item of five tables \u2014 systematic reviews, benefits, risks, interactions, protocol. topic: a new EVID; or evid. The server writes the queries. Takes minutes: answers evid and state "running"; fh_evmap_get_map answers the state, then the map. Built once per EVID; failed or interrupted: call again.`,
8711
+ `Builds the evidence map of a topic: the PubMed articles a review needs, picked per item of five tables \u2014 systematic reviews, benefits, risks, interactions, protocol. The server writes the queries. topic: makes a new EVID with metadata { "topic": <as given> } and builds its map \u2014 every call a new one, so look first: fh_evid_find({ "topic": <the same text> }). evid: an existing EVID. Takes minutes: answers evid and state "running"; fh_evmap_get_map answers the state, then the map. Built once per EVID; failed or interrupted: call again with the same evid.`,
8711
8712
  {
8712
- topic: z.string().optional().describe('A topic, e.g. "Telmisartan for Health & Longevity".'),
8713
- evid: z.string().optional().describe('Instead of topic: an existing EVID with "topic" in its metadata.')
8713
+ topic: z.string().optional().describe('The intervention and its goal, e.g. "Telmisartan for Health & Longevity". The goal decides what is picked: for health and longevity, prevention and long-term use before acute care.'),
8714
+ evid: z.string().optional().describe('Instead of topic: an existing EVID with "topic" in its metadata \u2014 the intervention and its goal, as above.')
8714
8715
  },
8715
8716
  async ({ topic, evid: evidArg }) => {
8716
8717
  const answer = (o, isError = false) => ({ content: [{ type: "text", text: compact2(o) }], ...isError ? { isError: true } : {} });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evidence-mcp-dev",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "Internal development build of evidence-mcp. Not for public use.",
5
5
  "type": "module",
6
6
  "bin": {