evidence-mcp-dev 1.0.24 → 1.0.25
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 +28 -59
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6979,62 +6979,31 @@ var pkg = (() => {
|
|
|
6979
6979
|
return { name: "evidence-mcp", version: "0.0.0" };
|
|
6980
6980
|
}
|
|
6981
6981
|
})();
|
|
6982
|
-
var INSTRUCTIONS = `evidence-mcp keeps a local library of scientific articles, FDA drug labels, clinical trial records and web pages, so you can check what a source actually says
|
|
6982
|
+
var INSTRUCTIONS = `evidence-mcp keeps a local library of scientific articles, FDA drug labels, clinical trial records and web pages, so you can check what a source actually says. Each record is downloaded once, stored as Markdown and read in small pieces: answers are small JSON, the document never enters your context \u2014 except fh_fetch_url, the standard fetch tool with a cache.
|
|
6983
6983
|
|
|
6984
|
-
IDs \u2014
|
|
6985
|
-
- pmid:30955454 \u2014 an article
|
|
6986
|
-
- doi:10.\u2026 \u2014 an article
|
|
6987
|
-
- dailymed:<set ID> \u2014 an FDA
|
|
6988
|
-
- nct:05173896 \u2014 a ClinicalTrials.gov
|
|
6984
|
+
IDs \u2014 "type:value", one per call (fh_pubmed_fetch_articles: up to 200 PMIDs)
|
|
6985
|
+
- pmid:30955454 \u2014 an article; bare digits count as a PMID.
|
|
6986
|
+
- doi:10.\u2026 \u2014 an article; a DOI PubMed indexes is stored under its PMID, any other comes from Crossref.
|
|
6987
|
+
- dailymed:<set ID> \u2014 an FDA label, current version; the set ID from fh_dailymed_search_labels or the label URL's "setid=".
|
|
6988
|
+
- nct:05173896 \u2014 a ClinicalTrials.gov record, current version; NCT05173896 is accepted.
|
|
6989
|
+
A URL is no ID: send the ID of a PubMed, doi.org, ClinicalTrials.gov or DailyMed URL; any other page: fh_fetch_url.
|
|
6989
6990
|
|
|
6990
6991
|
Tools
|
|
6991
|
-
-
|
|
6992
|
-
-
|
|
6993
|
-
-
|
|
6994
|
-
-
|
|
6995
|
-
-
|
|
6996
|
-
- 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 articles from disk, the rest in one request and stored. For abstract or full text: fh_library_read.
|
|
6997
|
-
- 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.
|
|
6998
|
-
${citationsEnabled() ? "- fh_pubmed_citing_articles(id, types?, years?, sort?, max_results?) \u2014 the articles that cite an article (pmid: or doi:), as rows in fh_pubmed_search_articles' columns: follow-ups of a trial, later meta-analyses that include it, guidelines (sort: cited), comments on it (types comment, letter, editorial: PubMed's comments on the article first, listed in comments_on). At most 100 rows, no paging: narrow with types or years. Cached a week.\n" : ""}${evidEnabled() ? "- fh_evid_create(metadata), fh_evid_find(query), fh_evid_list_objects(evid), fh_evid_put(evid, name, content), fh_evid_get(evid, name, section?, query?, lines?, max_chars?, max_hits?, previous?) \u2014 an EVID (evid:<16 hex digits>) is a store that outlives the session: metadata fixed at creation, objects (.json, .csv, .txt, .md) any later session or agent given the EVID reads back. Nothing can be deleted; a put keeps the replaced object as its previous version.\n" : ""}${evidenceMapEnabled() ? "- fh_create_evidence_map(topic | evid, queries, screening?) \u2014 builds the evidence map for a topic: the PubMed articles that matter, most important first.\n- fh_get_evidence_map(evid, top?) \u2014 reads it.\n" : ""}- 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.
|
|
6999
|
-
- 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.
|
|
7000
|
-
${webSearchConfigured() ? "- fh_web_search(query, max_results?) \u2014 search the web; use it instead of the built-in web search. Links (title, URL, date, author) with a short passage from each page, not the page text, so a fraction of the context; read a result with fh_fetch_url. site: in the query restricts it to a site, as with any search engine. For more results, search again with other words. Cached locally for a week.\n" : ""}- 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.
|
|
7001
|
-
- 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.
|
|
7002
|
-
- 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.
|
|
6992
|
+
- Library: fh_library_add, fh_library_status, fh_library_read (outline, one section, or the passages for a query), fh_verify_claim (does this one source state this one finding?).
|
|
6993
|
+
- Search: fh_pubmed_search_articles, fh_pubmed_fetch_articles${citationsEnabled() ? ", fh_pubmed_citing_articles" : ""}, fh_clinicaltrials_search_studies, fh_dailymed_search_labels${webSearchConfigured() ? ", fh_web_search (instead of the built-in web search)" : ""}.
|
|
6994
|
+
- Trials: fh_clinicaltrials_get_study_record, fh_clinicaltrials_get_study_results.
|
|
6995
|
+
- Web: fh_fetch_url, for every URL that is not an article, label or trial record.
|
|
6996
|
+
${evidEnabled() ? "- EVID: fh_evid_create, fh_evid_find, fh_evid_list_objects, fh_evid_put, fh_evid_get \u2014 a store that outlives the session.\n" : ""}${evidenceMapEnabled() ? "- Evidence map: fh_create_evidence_map, fh_get_evidence_map.\n" : ""}- fh_info: this server's version and the library.
|
|
7003
6997
|
|
|
7004
|
-
|
|
7005
|
-
- fh_library_read and fh_verify_claim store a missing record themselves
|
|
7006
|
-
- Many articles to look over
|
|
7007
|
-
-
|
|
7008
|
-
-
|
|
7009
|
-
-
|
|
7010
|
-
-
|
|
7011
|
-
-
|
|
7012
|
-
-
|
|
7013
|
-
|
|
7014
|
-
Verifying a claim
|
|
7015
|
-
- fh_verify_claim judges one claim against one stored document. A finding backed by three articles takes three calls with the same claim.
|
|
7016
|
-
- It expects the finding as a complete sentence: who or what, the intervention, the outcome, the number. Citation markers and commentary around the finding are not part of what a document states.
|
|
7017
|
-
- It can only confirm what this one document states. A finding about two interventions from two articles is two claims, each against its own article. A summary of several trials ("trials used 60\u2013200 mg") is stated by none of them; the dose this one trial used is.
|
|
7018
|
-
- It returns error for a claim under four words, a sentence fragment, or a claim still containing citations. A short finding with its setting (in vitro, cell line, dose) is accepted; filler words do not help.
|
|
7019
|
-
- verdict "supported" \u2014 the document states the claim. score is the model's probability.
|
|
7020
|
-
- verdict "not_supported" \u2014 the stored full text does not state the claim as worded; fh_library_read with a query shows what the document does say. Or, with basis "title", nothing is stored to read: reason says so, score is null.
|
|
7021
|
-
- verdict "unverifiable" \u2014 only the abstract is stored and it does not state the claim; the full text may (reason says so). A retry gives the same answer until a full text is stored.
|
|
7022
|
-
- glyphs_unresolved above 0 \u2014 the PDF font lost symbols (minus, \xB1, \u2264); a fail on a number may be the font. fh_library_read shows the passage.
|
|
7023
|
-
- superseded true \u2014 a published correction replaced the figure the claim uses; the status's corrections holds the notice.
|
|
7024
|
-
- Verdicts are kept for 30 days: the same claim against the same stored text answers from disk, no model call. An article that gains its full text is judged afresh.
|
|
7025
|
-
|
|
7026
|
-
Reading a document
|
|
7027
|
-
- fh_library_read with only the ID returns the outline: every heading with its word count, and whether the full text or only the abstract is stored.
|
|
7028
|
-
- section \u2014 a heading from the outline, matched case-insensitively as a substring; the text is capped at max_chars (default 6000). A heading that occurs several times is listed as "Participants [3/12]" and is addressed that way.
|
|
7029
|
-
- query \u2014 returns the passages holding every term: up to max_hits (default 5), each at most 1000 characters around the matches, with its section, best first. It works best with two or three distinctive terms the document itself would use (a measure and a unit, an outcome and a group, a compound name), not a claim sentence. Case, accents, hyphens, plurals and -ed/-ing forms are matched.
|
|
7030
|
-
- partial true \u2014 no passage holds every term; missing_terms are the words the document never uses. The same query without them finds the passage if there is one.
|
|
7031
|
-
- Numbers are often in tables; a matching table row comes with its header row.
|
|
7032
|
-
- section and query together search inside that section only.
|
|
7033
|
-
- section "Abstract" on a full text without one returns the stored abstract. section "Declarations" returns funding, conflicts of interest, acknowledgements and ethics statements, assembled when the document has no section of that name, else the statements of the PubMed or Crossref record.
|
|
7034
|
-
|
|
7035
|
-
Status fields: pmid, pmcid, setid, nctid, publications, year, publication_types, retracted, corrections, citable, comment, has_abstract, level, fulltext, version, retrieved_by, glyphs_unresolved, error. fulltext: "not tried" (no source tried yet) or "stored" (abstract_only read, full text exists). Funding and conflicts of interest: fh_library_read section "Declarations". Answers carry only what the call did not send: no echo of the ID, claim or query; a field that is null or an empty list is left out. fh_verify_claim always has verdict, score (null: no judgement) and basis.
|
|
7036
|
-
|
|
7037
|
-
Where records come from: PubMed for the record and abstract; the full text from PubMed Central, Europe PMC, publishers' text-mining links, Unpaywall, OpenAlex, CORE, and a proxy URL template from the configuration. Every action is appended as one line to <library>/logs/evidence.log.`;
|
|
6998
|
+
Rules
|
|
6999
|
+
- fh_library_read and fh_verify_claim store a missing record themselves (added: true); no fh_library_add first.
|
|
7000
|
+
- Many articles to look over: fh_library_read with abstract_only: true for each, then without it only where the full text is needed.
|
|
7001
|
+
- level: "full_text", "abstract" or "title". fulltext "not tried": stored from PubMed alone; the next read without abstract_only, verify or add searches for the full text.
|
|
7002
|
+
- citable false: retracted, or nothing to read; comment says which, corrections lists the notices.
|
|
7003
|
+
- "pmid not found" and the like: no service knows the ID; remembered for a day. "invalid id": the ID is malformed.
|
|
7004
|
+
- fh_library_add, fh_library_read and fh_verify_claim may run in parallel; calls on the same missing record share one add.
|
|
7005
|
+
- Answers leave out null fields and empty lists and echo nothing you sent.
|
|
7006
|
+
- Every action is one line in <library>/logs/evidence.log.`;
|
|
7038
7007
|
var idSchema = z.string().describe('ID as "type:value": an article "pmid:30955454" (bare digits count as pmid) or "doi:10.5812/asjsm.110753" (an article PubMed does not index; a DOI PubMed indexes is taken as its PMID), a drug label "dailymed:<set ID>" (the set ID from fh_dailymed_search_labels, or the "setid=" value of its DailyMed URL), or a trial record "nct:05173896" (the eight digits; nct:NCT05173896 and a bare NCT05173896 are accepted).');
|
|
7039
7008
|
var levelWord = (m) => m.level === "abstract" && !m.has_abstract ? "title" : m.level;
|
|
7040
7009
|
var json = (s) => ({ content: [{ type: "text", text: statusAnswer(s) }] });
|
|
@@ -7165,7 +7134,7 @@ function registerTools(server2) {
|
|
|
7165
7134
|
}
|
|
7166
7135
|
server2.tool(
|
|
7167
7136
|
"fh_library_add",
|
|
7168
|
-
"Download and store one record \u2014 an article (pmid:, doi:), a drug label (dailymed:<set ID>) or a trial record (nct:<8 digits>) \u2014 and return its status JSON. An article gets its record, abstract and correction notices from PubMed (Crossref for a DOI PubMed does not index), then the full text from the configured sources; a label or trial record is stored as a full text. A stored full text is returned without any download; an abstract-level record retries only sources that failed transiently; a record older than 30 days gets its notices re-read.",
|
|
7137
|
+
"Download and store one record \u2014 an article (pmid:, doi:), a drug label (dailymed:<set ID>) or a trial record (nct:<8 digits>) \u2014 and return its status JSON (fields: fh_library_status). An article gets its record, abstract and correction notices from PubMed (Crossref for a DOI PubMed does not index), then the full text from the configured sources; a label or trial record is stored as a full text. A stored full text is returned without any download; an abstract-level record retries only sources that failed transiently; a record older than 30 days gets its notices re-read.",
|
|
7169
7138
|
{ id: idSchema },
|
|
7170
7139
|
({ id }) => addEntry(id)
|
|
7171
7140
|
);
|
|
@@ -7332,7 +7301,7 @@ function registerTools(server2) {
|
|
|
7332
7301
|
}
|
|
7333
7302
|
server2.tool(
|
|
7334
7303
|
"fh_library_status",
|
|
7335
|
-
'Read-only status of the library entry for one ID \u2014 an article, a drug label or a trial record: the same status JSON as fh_library_add, or level "missing" when there is no entry. Never fetches.',
|
|
7304
|
+
'Read-only status of the library entry for one ID \u2014 an article, a drug label or a trial record: the same status JSON as fh_library_add, or level "missing" when there is no entry. Never fetches. Fields: pmid, pmcid, setid, nctid, publications, year, publication_types, retracted, corrections ({type, pmid, source}), citable, comment, has_abstract, level (full_text | abstract | title), fulltext ("not tried": no source tried yet; "stored": the full text exists, an abstract_only read did not use it), version, retrieved_by, glyphs_unresolved (symbols the PDF font lost), error.',
|
|
7336
7305
|
{ id: idSchema },
|
|
7337
7306
|
async ({ id }) => {
|
|
7338
7307
|
const parsed = parseId(id);
|
|
@@ -7354,7 +7323,7 @@ function registerTools(server2) {
|
|
|
7354
7323
|
);
|
|
7355
7324
|
server2.tool(
|
|
7356
7325
|
"fh_library_read",
|
|
7357
|
-
`One piece of a stored document's Markdown, never the whole. No section/query: the outline (headings with word counts; full text or abstract only). section: that heading's own text (case-insensitive substring; a repeated heading as "Participants [3/12]"), capped at max_chars, its subsections listed. query: passages holding every term, each a window of at most 1000 chars with its section, best first, at most max_hits (more: how many further passages match); partial: true with missing_terms when no passage holds them all. section and query together: inside that section. A missing article is added first (added: true). abstract_only: true reads only the abstract, at once \u2014 use it whenever the abstract is enough (screening, design, size, main finding); without it, an article whose full text was never searched for gets a search for the full text first (seconds, up to a minute, once).`,
|
|
7326
|
+
`One piece of a stored document's Markdown, never the whole. No section/query: the outline (headings with word counts; full text or abstract only). section: that heading's own text (case-insensitive substring; a repeated heading as "Participants [3/12]"), capped at max_chars, its subsections listed. query: passages holding every term, each a window of at most 1000 chars with its section, best first, at most max_hits (more: how many further passages match); partial: true with missing_terms when no passage holds them all. section and query together: inside that section. Case, accents, hyphens, plurals and -ed/-ing forms match; a matching table row comes with its header row. section "Abstract" on a full text without one: the stored abstract; "Declarations": funding, conflicts of interest, acknowledgements, ethics. A missing article is added first (added: true). abstract_only: true reads only the abstract, at once \u2014 use it whenever the abstract is enough (screening, design, size, main finding); without it, an article whose full text was never searched for gets a search for the full text first (seconds, up to a minute, once).`,
|
|
7358
7327
|
{
|
|
7359
7328
|
id: idSchema,
|
|
7360
7329
|
section: z.string().optional().describe("Heading from the outline (case-insensitive substring)."),
|
|
@@ -7463,7 +7432,7 @@ ${st.funding.map((f) => `- ${f}`).join("\n")}` : ""].filter(Boolean).join("\n\n"
|
|
|
7463
7432
|
);
|
|
7464
7433
|
server2.tool(
|
|
7465
7434
|
"fh_verify_claim",
|
|
7466
|
-
`Does one source state one finding of a review? claim: the finding as a complete statement (subject, intervention, outcome, number), without citations or the review's framing, and only what this source reports. id: one source the review cites for it \u2014 article, drug label (dailymed:\u2026) or trial record (nct:\u2026); added first when missing. fulltext "not tried": a search for the full text first (seconds, up to a minute, once). The server reads the stored text and asks a decision model; nothing enters your context.
|
|
7435
|
+
`Does one source state one finding of a review? claim: the finding as a complete statement (subject, intervention, outcome, number), without citations or the review's framing, and only what this source reports. id: one source the review cites for it \u2014 article, drug label (dailymed:\u2026) or trial record (nct:\u2026); added first when missing. fulltext "not tried": a search for the full text first (seconds, up to a minute, once). The server reads the stored text and asks a decision model; nothing enters your context. One claim, one source: a finding backed by three articles is three calls; a summary of several trials is stated by none of them. verdict: supported | not_supported (the full text does not state it \u2014 fh_library_read with a query shows what it says; or only the title is stored \u2014 reason says so) | unverifiable (only the abstract is stored and does not state it \u2014 reason says so; the same until a full text is stored) | error (claim refused: under four words, a fragment, carrying citations; add failed; no model; model failure). basis: full_text | abstract | title. glyphs_unresolved: symbols the PDF font lost; above 0 a failed number may be the font. superseded: true when a stored correction replaced the claim's figure. score: the probability that the source states the claim, with every judged verdict; null: no judgement. The same claim on the same stored text answers from disk for 30 days.`,
|
|
7467
7436
|
{
|
|
7468
7437
|
claim: z.string().describe("One finding as a complete statement (subject, intervention, outcome, number), built from the review's words, without its citations and framing."),
|
|
7469
7438
|
id: idSchema
|
|
@@ -7491,7 +7460,7 @@ ${st.funding.map((f) => `- ${f}`).join("\n")}` : ""].filter(Boolean).join("\n\n"
|
|
|
7491
7460
|
);
|
|
7492
7461
|
server2.tool(
|
|
7493
7462
|
"fh_info",
|
|
7494
|
-
"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; per type (pmid, doi, dailymed, nct) the entries by level (full_text, abstract, title) and
|
|
7463
|
+
"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; 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); counts of retracted and not-citable entries and of errata, expressions of concern and 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); 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 for fh_verify_claim and fh_fetch_url since it started (cache).",
|
|
7495
7464
|
{},
|
|
7496
7465
|
async () => {
|
|
7497
7466
|
const info = libraryInfo(FH_EVIDENCE_DIR, HOST);
|
|
@@ -7517,7 +7486,7 @@ ${st.funding.map((f) => `- ${f}`).join("\n")}` : ""].filter(Boolean).join("\n\n"
|
|
|
7517
7486
|
);
|
|
7518
7487
|
server2.tool(
|
|
7519
7488
|
"fh_fetch_url",
|
|
7520
|
-
`Fetch a web page as Markdown: the standard fetch tool, cached and hardened. Use it for any URL instead of a plain fetch or a browser. A page fetched in the last ${settings().refresh_after_days} days is answered from disk in milliseconds; a page a plain fetch cannot get (403, rate limit, bot wall, script-rendered) is fetched through the configured browsers and unlockers in this one call. PDFs come back as Markdown; XML, JSON and other text as is. To verify a link, title_only returns just its title line. A PubMed, ClinicalTrials.gov, DailyMed or doi.org URL is answered from the library's record of it.`,
|
|
7489
|
+
`Fetch a web page as Markdown: the standard fetch tool, cached and hardened. Use it for any URL instead of a plain fetch or a browser. A page fetched in the last ${settings().refresh_after_days} days is answered from disk in milliseconds; a page a plain fetch cannot get (403, rate limit, bot wall, script-rendered) is fetched through the configured browsers and unlockers in this one call. PDFs come back as Markdown; XML, JSON and other text as is. To verify a link, title_only returns just its title line. A PubMed, ClinicalTrials.gov, DailyMed or doi.org URL is answered from the library's record of it. A failed fetch is remembered for ${settings().retry_after_days} d.`,
|
|
7521
7490
|
{
|
|
7522
7491
|
url: z.string().describe("URL to fetch"),
|
|
7523
7492
|
// Optional, not .default(5000): the log tells a model that set none from one that asked for 5000.
|
|
@@ -7760,7 +7729,7 @@ Citations from OpenAlex. Cached ${searchCacheDays()} days.`,
|
|
|
7760
7729
|
);
|
|
7761
7730
|
server2.tool(
|
|
7762
7731
|
"fh_clinicaltrials_search_studies",
|
|
7763
|
-
`Search ClinicalTrials.gov by free text, intervention or condition; status ongoing | completed | all; sort relevance | newest | largest | completion. Returns the total and up to ${MAX_RESULTS} rows as arrays in columns order: NCT ID, title, status, phase, enrollment ("~100" estimated), start, primary completion, primary outcome, conditions, interventions, has_results. Link: https://clinicaltrials.gov/study/<NCT ID>. Cached ${searchCacheDays()} days. One trial in detail: fh_clinicaltrials_get_study_record.`,
|
|
7732
|
+
`Search ClinicalTrials.gov by free text, intervention or condition \u2014 at least one of them; status ongoing | completed | all; sort relevance | newest | largest | completion. Returns the total and up to ${MAX_RESULTS} rows as arrays in columns order: NCT ID, title, status, phase, enrollment ("~100" estimated), start, primary completion, primary outcome, conditions, interventions, has_results. Link: https://clinicaltrials.gov/study/<NCT ID>. Cached ${searchCacheDays()} days. One trial in detail: fh_clinicaltrials_get_study_record.`,
|
|
7764
7733
|
{
|
|
7765
7734
|
query: z.string().optional().describe("Free-text search across all fields (title, conditions, interventions, summary, \u2026); AND / OR / NOT allowed."),
|
|
7766
7735
|
intervention: z.string().optional().describe('Intervention or treatment, e.g. "tadalafil", "cognitive behavioral therapy".'),
|