@djmima/pubmed-mcp 0.0.0-stage → 1.0.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.
- package/LICENSE +21 -0
- package/README.md +793 -3
- package/dist/auth.d.ts +39 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +97 -0
- package/dist/auth.js.map +1 -0
- package/dist/cli/commands.d.ts +42 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +508 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/run.d.ts +21 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +154 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli.d.ts +16 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +52 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +126 -0
- package/dist/index.js.map +1 -0
- package/dist/pubmed/client.d.ts +150 -0
- package/dist/pubmed/client.d.ts.map +1 -0
- package/dist/pubmed/client.js +315 -0
- package/dist/pubmed/client.js.map +1 -0
- package/dist/pubmed/types.d.ts +159 -0
- package/dist/pubmed/types.d.ts.map +1 -0
- package/dist/pubmed/types.js +11 -0
- package/dist/pubmed/types.js.map +1 -0
- package/dist/server.d.ts +18 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +157 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/convertArticleIds.d.ts +25 -0
- package/dist/tools/convertArticleIds.d.ts.map +1 -0
- package/dist/tools/convertArticleIds.js +39 -0
- package/dist/tools/convertArticleIds.js.map +1 -0
- package/dist/tools/findRelatedArticles.d.ts +30 -0
- package/dist/tools/findRelatedArticles.d.ts.map +1 -0
- package/dist/tools/findRelatedArticles.js +77 -0
- package/dist/tools/findRelatedArticles.js.map +1 -0
- package/dist/tools/getArticleMetadata.d.ts +31 -0
- package/dist/tools/getArticleMetadata.d.ts.map +1 -0
- package/dist/tools/getArticleMetadata.js +72 -0
- package/dist/tools/getArticleMetadata.js.map +1 -0
- package/dist/tools/getCopyrightStatus.d.ts +25 -0
- package/dist/tools/getCopyrightStatus.d.ts.map +1 -0
- package/dist/tools/getCopyrightStatus.js +84 -0
- package/dist/tools/getCopyrightStatus.js.map +1 -0
- package/dist/tools/getFullTextArticle.d.ts +21 -0
- package/dist/tools/getFullTextArticle.d.ts.map +1 -0
- package/dist/tools/getFullTextArticle.js +89 -0
- package/dist/tools/getFullTextArticle.js.map +1 -0
- package/dist/tools/lookupArticleByCitation.d.ts +33 -0
- package/dist/tools/lookupArticleByCitation.d.ts.map +1 -0
- package/dist/tools/lookupArticleByCitation.js +96 -0
- package/dist/tools/lookupArticleByCitation.js.map +1 -0
- package/dist/tools/searchArticles.d.ts +49 -0
- package/dist/tools/searchArticles.d.ts.map +1 -0
- package/dist/tools/searchArticles.js +121 -0
- package/dist/tools/searchArticles.js.map +1 -0
- package/dist/utils/xml.d.ts +37 -0
- package/dist/utils/xml.d.ts.map +1 -0
- package/dist/utils/xml.js +515 -0
- package/dist/utils/xml.js.map +1 -0
- package/package.json +72 -4
- package/skills/pubmed-cli/SKILL.md +79 -0
package/dist/server.js
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP server setup and tool registration.
|
|
3
|
+
*
|
|
4
|
+
* All seven PubMed tools are registered here. Each tool handler calls
|
|
5
|
+
* the appropriate function from src/tools/, catches errors, and returns
|
|
6
|
+
* a text content block (never throws — MCP protocol requires graceful errors).
|
|
7
|
+
*/
|
|
8
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
9
|
+
import { NcbiClient } from './pubmed/client.js';
|
|
10
|
+
import { searchArticlesSchema, searchArticles, } from './tools/searchArticles.js';
|
|
11
|
+
import { getArticleMetadataSchema, getArticleMetadata, } from './tools/getArticleMetadata.js';
|
|
12
|
+
import { findRelatedArticlesSchema, findRelatedArticles, } from './tools/findRelatedArticles.js';
|
|
13
|
+
import { lookupArticleByCitationSchema, lookupArticleByCitation, } from './tools/lookupArticleByCitation.js';
|
|
14
|
+
import { convertArticleIdsSchema, convertArticleIds, } from './tools/convertArticleIds.js';
|
|
15
|
+
import { getFullTextArticleSchema, getFullTextArticle, } from './tools/getFullTextArticle.js';
|
|
16
|
+
import { getCopyrightStatusSchema, getCopyrightStatus, } from './tools/getCopyrightStatus.js';
|
|
17
|
+
/**
|
|
18
|
+
* Create and return a configured MCP server instance.
|
|
19
|
+
*
|
|
20
|
+
* @param client NCBI client used by every tool. Rate limiting is per client,
|
|
21
|
+
* so pass one shared client when creating several servers (HTTP mode
|
|
22
|
+
* creates one per request). Defaults to a new client.
|
|
23
|
+
*/
|
|
24
|
+
export function createServer(client = new NcbiClient()) {
|
|
25
|
+
const server = new McpServer({
|
|
26
|
+
name: 'pubmed',
|
|
27
|
+
version: '1.0.0',
|
|
28
|
+
});
|
|
29
|
+
// ── search_articles ──────────────────────────────────────────────────────
|
|
30
|
+
server.tool('search_articles', 'Search PubMed for biomedical articles. Returns PMIDs and result set metadata. ' +
|
|
31
|
+
'Untagged terms undergo automatic term mapping (ATM); use field to restrict all ' +
|
|
32
|
+
'untagged terms to one PubMed field. Explicit field tags in the query take ' +
|
|
33
|
+
'precedence for tagged terms. Before concluding that a low or zero count means ' +
|
|
34
|
+
'no literature exists, inspect query_translation, warnings, and errors. To search ' +
|
|
35
|
+
'multiple words reliably in one field, tag each term; when a quoted phrase is not ' +
|
|
36
|
+
'indexed, use a proximity search such as [ti:~0] or [tiab:~0]. ' +
|
|
37
|
+
'Use get_article_metadata to retrieve full details for the returned PMIDs.', searchArticlesSchema, async (params) => {
|
|
38
|
+
try {
|
|
39
|
+
const result = await searchArticles(params, client);
|
|
40
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
return { content: [{ type: 'text', text: formatError(err, 'search_articles') }] };
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
// ── get_article_metadata ─────────────────────────────────────────────────
|
|
47
|
+
server.tool('get_article_metadata', 'Retrieve complete metadata for up to 200 PubMed articles by PMID. ' +
|
|
48
|
+
'Returns title, abstract, authors, journal info, ' +
|
|
49
|
+
'publication date, MeSH terms, keywords, and article type for each article. ' +
|
|
50
|
+
'Affiliations are left out unless include_affiliations is true. ' +
|
|
51
|
+
'Long author lists use a lot of context: set authors ' +
|
|
52
|
+
'(first_last, first, none) to return fewer; ' +
|
|
53
|
+
'author_count always gives the full number of authors. ' +
|
|
54
|
+
'PMIDs that PubMed does not return are left out of articles, so compare count ' +
|
|
55
|
+
'with the number of PMIDs requested.', getArticleMetadataSchema, async (params) => {
|
|
56
|
+
try {
|
|
57
|
+
const result = await getArticleMetadata(params, client);
|
|
58
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
return {
|
|
62
|
+
content: [{ type: 'text', text: formatError(err, 'get_article_metadata') }],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
// ── find_related_articles ────────────────────────────────────────────────
|
|
67
|
+
server.tool('find_related_articles', 'Find articles related to one or more PubMed articles using NCBI ELink. ' +
|
|
68
|
+
'Supports similar articles, PMC articles that cite the source, ' +
|
|
69
|
+
'and cross-database links to NCBI Gene, Protein, or Nucleotide databases. ' +
|
|
70
|
+
'Returned links are IDs in the target database: PMIDs for similar_articles, ' +
|
|
71
|
+
'numeric PMC IDs without the "PMC" prefix for citing_pmc_articles (convert them ' +
|
|
72
|
+
'with convert_article_ids, id_type pmcid), and Gene or RefSeq record IDs for ' +
|
|
73
|
+
'the linked_* types.', findRelatedArticlesSchema, async (params) => {
|
|
74
|
+
try {
|
|
75
|
+
const result = await findRelatedArticles(params, client);
|
|
76
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
return {
|
|
80
|
+
content: [{ type: 'text', text: formatError(err, 'find_related_articles') }],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
// ── lookup_article_by_citation ────────────────────────────────────────────
|
|
85
|
+
server.tool('lookup_article_by_citation', 'Look up PubMed IDs for articles given structured citation information ' +
|
|
86
|
+
'(journal, year, volume, first page, first author). ' +
|
|
87
|
+
'Useful for verifying references or resolving citations found in manuscripts. ' +
|
|
88
|
+
'Each result echoes its key; pmid is an empty string when no article matched.', lookupArticleByCitationSchema, async (params) => {
|
|
89
|
+
try {
|
|
90
|
+
const result = await lookupArticleByCitation(params, client);
|
|
91
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
return {
|
|
95
|
+
content: [
|
|
96
|
+
{ type: 'text', text: formatError(err, 'lookup_article_by_citation') },
|
|
97
|
+
],
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
// ── convert_article_ids ──────────────────────────────────────────────────
|
|
102
|
+
server.tool('convert_article_ids', 'Convert article identifiers between PMID, PMCID, and DOI formats. ' +
|
|
103
|
+
'For example, convert a list of PMIDs to DOIs, or find the PMCID for a DOI. ' +
|
|
104
|
+
'Uses the NCBI PMC ID Converter service, up to 200 IDs per request. ' +
|
|
105
|
+
'IDs it cannot convert come back as records with errmsg set.', convertArticleIdsSchema, async (params) => {
|
|
106
|
+
try {
|
|
107
|
+
const result = await convertArticleIds(params, client);
|
|
108
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
return {
|
|
112
|
+
content: [{ type: 'text', text: formatError(err, 'convert_article_ids') }],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
// ── get_full_text_article ────────────────────────────────────────────────
|
|
117
|
+
server.tool('get_full_text_article', 'Retrieve the full text of articles from PubMed Central (PMC). ' +
|
|
118
|
+
'Returns the complete article body including all sections, figure captions, ' +
|
|
119
|
+
'table captions, and references as plain text. ' +
|
|
120
|
+
'Full text is available for PMC articles whose publisher allows full-text ' +
|
|
121
|
+
'download; unavailable articles are reported in the errors array. ' +
|
|
122
|
+
'Starting from PMIDs, get_copyright_status returns each pmcid and has_full_text.', getFullTextArticleSchema, async (params) => {
|
|
123
|
+
try {
|
|
124
|
+
const result = await getFullTextArticle(params, client);
|
|
125
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
return {
|
|
129
|
+
content: [{ type: 'text', text: formatError(err, 'get_full_text_article') }],
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
// ── get_copyright_status ─────────────────────────────────────────────────
|
|
134
|
+
server.tool('get_copyright_status', 'Check the copyright and open-access status for PubMed articles. ' +
|
|
135
|
+
'has_full_text: true means get_full_text_article can return the article text; ' +
|
|
136
|
+
'it is false for articles not in PMC and for PMC articles whose publisher ' +
|
|
137
|
+
'does not allow full-text download. Also reports the license (e.g., CC BY, ' +
|
|
138
|
+
'CC BY-NC-ND), copyright statement, and whether PMC marks the article open access.', getCopyrightStatusSchema, async (params) => {
|
|
139
|
+
try {
|
|
140
|
+
const result = await getCopyrightStatus(params, client);
|
|
141
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
return {
|
|
145
|
+
content: [{ type: 'text', text: formatError(err, 'get_copyright_status') }],
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
return server;
|
|
150
|
+
}
|
|
151
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
152
|
+
function formatError(err, tool) {
|
|
153
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
154
|
+
process.stderr.write(`[${tool}] Error: ${message}\n`);
|
|
155
|
+
return JSON.stringify({ error: `Error occurred during tool execution: ${message}` });
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EACL,oBAAoB,EACpB,cAAc,GACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,SAAqB,IAAI,UAAU,EAAE;IAChE,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,4EAA4E;IAE5E,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,gFAAgF;QAC9E,iFAAiF;QACjF,4EAA4E;QAC5E,gFAAgF;QAChF,mFAAmF;QACnF,mFAAmF;QACnF,gEAAgE;QAChE,2EAA2E,EAC7E,oBAAoB,EACpB,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM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EAA4E;QAC5E,mFAAmF,EACrF,wBAAwB,EACxB,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACxD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;QACvE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,sBAAsB,CAAC,EAAE,CAAC;aAC5E,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,iFAAiF;AAEjF,SAAS,WAAW,CAAC,GAAY,EAAE,IAAY;IAC7C,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,YAAY,OAAO,IAAI,CAAC,CAAC;IACtD,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,yCAAyC,OAAO,EAAE,EAAE,CAAC,CAAC;AACvF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: convert_article_ids
|
|
3
|
+
*
|
|
4
|
+
* Convert between different article identifier types: PMID, PMCID, and DOI.
|
|
5
|
+
* Uses the NCBI PMC ID Converter API.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import type { NcbiClient } from '../pubmed/client.js';
|
|
9
|
+
import type { ConvertArticleIdsResponse } from '../pubmed/types.js';
|
|
10
|
+
/** IDs per request; the CLI splits longer lists into batches of this size. */
|
|
11
|
+
export declare const MAX_CONVERT_IDS = 200;
|
|
12
|
+
export declare const convertArticleIdsSchema: {
|
|
13
|
+
ids: z.ZodArray<z.ZodString>;
|
|
14
|
+
id_type: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
15
|
+
pmid: "pmid";
|
|
16
|
+
pmcid: "pmcid";
|
|
17
|
+
doi: "doi";
|
|
18
|
+
}>>>;
|
|
19
|
+
};
|
|
20
|
+
export type ConvertArticleIdsParams = {
|
|
21
|
+
ids: string[];
|
|
22
|
+
id_type?: 'pmid' | 'pmcid' | 'doi';
|
|
23
|
+
};
|
|
24
|
+
export declare function convertArticleIds(params: ConvertArticleIdsParams, client: NcbiClient): Promise<ConvertArticleIdsResponse>;
|
|
25
|
+
//# sourceMappingURL=convertArticleIds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertArticleIds.d.ts","sourceRoot":"","sources":["../../src/tools/convertArticleIds.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAEpE,8EAA8E;AAC9E,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,eAAO,MAAM,uBAAuB;;;;;;;CAqBnC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;CACpC,CAAC;AAEF,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,yBAAyB,CAAC,CAcpC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: convert_article_ids
|
|
3
|
+
*
|
|
4
|
+
* Convert between different article identifier types: PMID, PMCID, and DOI.
|
|
5
|
+
* Uses the NCBI PMC ID Converter API.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
/** IDs per request; the CLI splits longer lists into batches of this size. */
|
|
9
|
+
export const MAX_CONVERT_IDS = 200;
|
|
10
|
+
export const convertArticleIdsSchema = {
|
|
11
|
+
ids: z
|
|
12
|
+
.array(z.string().min(1))
|
|
13
|
+
.min(1)
|
|
14
|
+
.max(MAX_CONVERT_IDS)
|
|
15
|
+
.describe('Array of article IDs to convert. ' +
|
|
16
|
+
'Format depends on id_type: PMIDs are numeric strings (e.g., "33526711"), ' +
|
|
17
|
+
'PMCIDs include the "PMC" prefix (e.g., "PMC7984072"), ' +
|
|
18
|
+
'DOIs are standard DOI strings (e.g., "10.1038/s41586-021-03819-2").'),
|
|
19
|
+
id_type: z
|
|
20
|
+
.enum(['pmid', 'pmcid', 'doi'])
|
|
21
|
+
.default('pmid')
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('Type of the input IDs:\n' +
|
|
24
|
+
' pmid — PubMed IDs (default)\n' +
|
|
25
|
+
' pmcid — PubMed Central IDs (with or without "PMC" prefix)\n' +
|
|
26
|
+
' doi — Digital Object Identifiers'),
|
|
27
|
+
};
|
|
28
|
+
export async function convertArticleIds(params, client) {
|
|
29
|
+
const idType = params.id_type ?? 'pmid';
|
|
30
|
+
// PMCIDs may come with or without the "PMC" prefix.
|
|
31
|
+
// The NCBI ID Converter API accepts both, but let's normalise.
|
|
32
|
+
const ids = idType === 'pmcid'
|
|
33
|
+
? params.ids.map((id) => (id.toUpperCase().startsWith('PMC') ? id : `PMC${id}`))
|
|
34
|
+
: params.ids;
|
|
35
|
+
const response = await client.idConvert({ ids, idtype: idType });
|
|
36
|
+
// Pass through the NCBI response shape, which already matches our type
|
|
37
|
+
return response;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=convertArticleIds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertArticleIds.js","sourceRoot":"","sources":["../../src/tools/convertArticleIds.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,8EAA8E;AAC9E,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AAEnC,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,GAAG,EAAE,CAAC;SACH,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACxB,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,eAAe,CAAC;SACpB,QAAQ,CACP,mCAAmC;QACjC,2EAA2E;QAC3E,wDAAwD;QACxD,qEAAqE,CACxE;IACH,OAAO,EAAE,CAAC;SACP,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;SAC9B,OAAO,CAAC,MAAM,CAAC;SACf,QAAQ,EAAE;SACV,QAAQ,CACP,0BAA0B;QACxB,kCAAkC;QAClC,+DAA+D;QAC/D,sCAAsC,CACzC;CACJ,CAAC;AAOF,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA+B,EAC/B,MAAkB;IAElB,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC;IAExC,oDAAoD;IACpD,+DAA+D;IAC/D,MAAM,GAAG,GACP,MAAM,KAAK,OAAO;QAChB,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAChF,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;IAEjB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAEjE,uEAAuE;IACvE,OAAO,QAAqC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: find_related_articles
|
|
3
|
+
*
|
|
4
|
+
* Find articles related to one or more PubMed articles using NCBI's ELink
|
|
5
|
+
* service. Supports cross-database links (PubMed→PubMed, PubMed→PMC, etc.).
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import type { NcbiClient } from '../pubmed/client.js';
|
|
9
|
+
import type { FindRelatedArticlesResponse } from '../pubmed/types.js';
|
|
10
|
+
declare const LINK_TYPES: readonly ["similar_articles", "citing_pmc_articles", "linked_gene_records", "linked_refseq_proteins", "linked_refseq_nucleotides"];
|
|
11
|
+
export type FindRelatedLinkType = (typeof LINK_TYPES)[number];
|
|
12
|
+
export declare const findRelatedArticlesSchema: {
|
|
13
|
+
pmids: z.ZodArray<z.ZodString>;
|
|
14
|
+
link_type: z.ZodDefault<z.ZodEnum<{
|
|
15
|
+
similar_articles: "similar_articles";
|
|
16
|
+
citing_pmc_articles: "citing_pmc_articles";
|
|
17
|
+
linked_gene_records: "linked_gene_records";
|
|
18
|
+
linked_refseq_proteins: "linked_refseq_proteins";
|
|
19
|
+
linked_refseq_nucleotides: "linked_refseq_nucleotides";
|
|
20
|
+
}>>;
|
|
21
|
+
max_results: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
};
|
|
23
|
+
export type FindRelatedArticlesParams = {
|
|
24
|
+
pmids: string[];
|
|
25
|
+
link_type?: FindRelatedLinkType;
|
|
26
|
+
max_results?: number;
|
|
27
|
+
};
|
|
28
|
+
export declare function findRelatedArticles(params: FindRelatedArticlesParams, client: NcbiClient): Promise<FindRelatedArticlesResponse>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=findRelatedArticles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findRelatedArticles.d.ts","sourceRoot":"","sources":["../../src/tools/findRelatedArticles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,2BAA2B,EAAW,MAAM,oBAAoB,CAAC;AAE/E,QAAA,MAAM,UAAU,oIAMN,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,eAAO,MAAM,yBAAyB;;;;;;;;;;CA0BrC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAWF,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,yBAAyB,EACjC,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,2BAA2B,CAAC,CAiCtC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: find_related_articles
|
|
3
|
+
*
|
|
4
|
+
* Find articles related to one or more PubMed articles using NCBI's ELink
|
|
5
|
+
* service. Supports cross-database links (PubMed→PubMed, PubMed→PMC, etc.).
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
const LINK_TYPES = [
|
|
9
|
+
'similar_articles',
|
|
10
|
+
'citing_pmc_articles',
|
|
11
|
+
'linked_gene_records',
|
|
12
|
+
'linked_refseq_proteins',
|
|
13
|
+
'linked_refseq_nucleotides',
|
|
14
|
+
];
|
|
15
|
+
export const findRelatedArticlesSchema = {
|
|
16
|
+
pmids: z
|
|
17
|
+
.array(z.string().min(1))
|
|
18
|
+
.min(1)
|
|
19
|
+
.describe('Array of source PubMed IDs to find related articles for.'),
|
|
20
|
+
link_type: z
|
|
21
|
+
.enum(LINK_TYPES)
|
|
22
|
+
.default('similar_articles')
|
|
23
|
+
.describe('Type of link to follow:\n' +
|
|
24
|
+
' similar_articles — computationally similar PubMed articles (default)\n' +
|
|
25
|
+
' citing_pmc_articles — PMC articles that cite the source article\n' +
|
|
26
|
+
' linked_gene_records — linked NCBI Gene records\n' +
|
|
27
|
+
' linked_refseq_proteins — linked RefSeq protein records\n' +
|
|
28
|
+
' linked_refseq_nucleotides — linked RefSeq nucleotide records'),
|
|
29
|
+
max_results: z
|
|
30
|
+
.number()
|
|
31
|
+
.int()
|
|
32
|
+
.min(1)
|
|
33
|
+
.max(1000)
|
|
34
|
+
.optional()
|
|
35
|
+
.describe('Maximum number of related article IDs to return per source article. ' +
|
|
36
|
+
'Note: NCBI does not natively limit ELink results; this is a client-side cap.'),
|
|
37
|
+
};
|
|
38
|
+
// Mapping from tool link_type values to NCBI elink linkname values
|
|
39
|
+
const LINK_TYPE_MAP = {
|
|
40
|
+
similar_articles: 'pubmed_pubmed',
|
|
41
|
+
citing_pmc_articles: 'pubmed_pmc_refs',
|
|
42
|
+
linked_gene_records: 'pubmed_gene',
|
|
43
|
+
linked_refseq_proteins: 'pubmed_protein_refseq',
|
|
44
|
+
linked_refseq_nucleotides: 'pubmed_nuccore_refseq',
|
|
45
|
+
};
|
|
46
|
+
export async function findRelatedArticles(params, client) {
|
|
47
|
+
const linkname = LINK_TYPE_MAP[params.link_type ?? 'similar_articles'];
|
|
48
|
+
const response = await client.elink({
|
|
49
|
+
dbfrom: 'pubmed',
|
|
50
|
+
id: params.pmids,
|
|
51
|
+
linkname,
|
|
52
|
+
cmd: 'neighbor',
|
|
53
|
+
});
|
|
54
|
+
const maxResults = params.max_results;
|
|
55
|
+
const linksets = (response.linksets ?? []).map((ls) => ({
|
|
56
|
+
dbfrom: ls.dbfrom,
|
|
57
|
+
ids: ls.ids,
|
|
58
|
+
linksetdbs: (ls.linksetdbs ?? []).map((lsdb) => {
|
|
59
|
+
// Transform link objects to plain PMID strings and optionally cap results
|
|
60
|
+
let links = lsdb.links.map((link) => {
|
|
61
|
+
if (typeof link === 'string')
|
|
62
|
+
return link;
|
|
63
|
+
return link.id;
|
|
64
|
+
});
|
|
65
|
+
if (maxResults !== undefined) {
|
|
66
|
+
links = links.slice(0, maxResults);
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
dbto: lsdb.dbto,
|
|
70
|
+
linkname: lsdb.linkname,
|
|
71
|
+
links,
|
|
72
|
+
};
|
|
73
|
+
}),
|
|
74
|
+
}));
|
|
75
|
+
return { linksets };
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=findRelatedArticles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findRelatedArticles.js","sourceRoot":"","sources":["../../src/tools/findRelatedArticles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,GAAG;IACjB,kBAAkB;IAClB,qBAAqB;IACrB,qBAAqB;IACrB,wBAAwB;IACxB,2BAA2B;CACnB,CAAC;AAGX,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACxB,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,0DAA0D,CAAC;IACvE,SAAS,EAAE,CAAC;SACT,IAAI,CAAC,UAAU,CAAC;SAChB,OAAO,CAAC,kBAAkB,CAAC;SAC3B,QAAQ,CACP,2BAA2B;QACzB,oFAAoF;QACpF,4EAA4E;QAC5E,2DAA2D;QAC3D,gEAAgE;QAChE,iEAAiE,CACpE;IACH,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,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AAI,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC7B,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;YACrC,CAAC;YACD,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,KAAK;aACN,CAAC;QACJ,CAAC,CAAC;KACH,CAAC,CAAC,CAAC;IAEJ,OAAO,EAAE,QAAQ,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: get_article_metadata
|
|
3
|
+
*
|
|
4
|
+
* Retrieve full metadata (title, abstract, authors, MeSH terms, etc.) for one
|
|
5
|
+
* or more PubMed articles identified by their PMIDs.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import type { NcbiClient } from '../pubmed/client.js';
|
|
9
|
+
import type { GetArticleMetadataResponse } from '../pubmed/types.js';
|
|
10
|
+
/** PMIDs per request; the CLI splits longer lists into batches of this size. */
|
|
11
|
+
export declare const MAX_METADATA_PMIDS = 200;
|
|
12
|
+
declare const AUTHOR_MODES: readonly ["all", "first_last", "first", "none"];
|
|
13
|
+
export type AuthorMode = (typeof AUTHOR_MODES)[number];
|
|
14
|
+
export declare const getArticleMetadataSchema: {
|
|
15
|
+
pmids: z.ZodArray<z.ZodString>;
|
|
16
|
+
authors: z.ZodDefault<z.ZodEnum<{
|
|
17
|
+
all: "all";
|
|
18
|
+
first_last: "first_last";
|
|
19
|
+
first: "first";
|
|
20
|
+
none: "none";
|
|
21
|
+
}>>;
|
|
22
|
+
include_affiliations: z.ZodDefault<z.ZodBoolean>;
|
|
23
|
+
};
|
|
24
|
+
export type GetArticleMetadataParams = {
|
|
25
|
+
pmids: string[];
|
|
26
|
+
authors?: AuthorMode;
|
|
27
|
+
include_affiliations?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare function getArticleMetadata(params: GetArticleMetadataParams, client: NcbiClient): Promise<GetArticleMetadataResponse>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=getArticleMetadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getArticleMetadata.d.ts","sourceRoot":"","sources":["../../src/tools/getArticleMetadata.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAiB,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAIpF,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,QAAA,MAAM,YAAY,iDAAkD,CAAC;AACrE,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,eAAO,MAAM,wBAAwB;;;;;;;;;CA4BpC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAqBF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,wBAAwB,EAChC,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,0BAA0B,CAAC,CAuBrC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: get_article_metadata
|
|
3
|
+
*
|
|
4
|
+
* Retrieve full metadata (title, abstract, authors, MeSH terms, etc.) for one
|
|
5
|
+
* or more PubMed articles identified by their PMIDs.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { IMPORTANT_LEGAL_NOTICE } from '../pubmed/types.js';
|
|
9
|
+
import { parsePubmedEfetchXml } from '../utils/xml.js';
|
|
10
|
+
/** PMIDs per request; the CLI splits longer lists into batches of this size. */
|
|
11
|
+
export const MAX_METADATA_PMIDS = 200;
|
|
12
|
+
const AUTHOR_MODES = ['all', 'first_last', 'first', 'none'];
|
|
13
|
+
export const getArticleMetadataSchema = {
|
|
14
|
+
pmids: z
|
|
15
|
+
.array(z.string().min(1))
|
|
16
|
+
.min(1)
|
|
17
|
+
.max(MAX_METADATA_PMIDS)
|
|
18
|
+
.describe('Array of PubMed IDs (PMIDs) to retrieve metadata for. ' +
|
|
19
|
+
`Maximum ${MAX_METADATA_PMIDS} PMIDs per request.`),
|
|
20
|
+
authors: z
|
|
21
|
+
.enum(AUTHOR_MODES)
|
|
22
|
+
.default('all')
|
|
23
|
+
.describe('Which authors to return, to save context on long author lists:\n' +
|
|
24
|
+
' all — every author (default)\n' +
|
|
25
|
+
' first_last — the first and last author (the last is usually the senior author)\n' +
|
|
26
|
+
' first — the first author only\n' +
|
|
27
|
+
' none — no authors\n' +
|
|
28
|
+
'author_count always gives the full number of authors.'),
|
|
29
|
+
include_affiliations: z
|
|
30
|
+
.boolean()
|
|
31
|
+
.default(false)
|
|
32
|
+
.describe('Include the affiliations of each returned author (default false). ' +
|
|
33
|
+
'Affiliations are repeated per author and often take most of the space; ' +
|
|
34
|
+
'set true to get them.'),
|
|
35
|
+
};
|
|
36
|
+
function selectAuthors(authors, mode) {
|
|
37
|
+
switch (mode) {
|
|
38
|
+
case 'all':
|
|
39
|
+
return authors;
|
|
40
|
+
case 'first_last':
|
|
41
|
+
return authors.length > 1 ? [authors[0], authors[authors.length - 1]] : authors;
|
|
42
|
+
case 'first':
|
|
43
|
+
return authors.slice(0, 1);
|
|
44
|
+
case 'none':
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function withoutAffiliations(author) {
|
|
49
|
+
const copy = { ...author };
|
|
50
|
+
delete copy.affiliations;
|
|
51
|
+
return copy;
|
|
52
|
+
}
|
|
53
|
+
export async function getArticleMetadata(params, client) {
|
|
54
|
+
const xml = await client.efetch({
|
|
55
|
+
db: 'pubmed',
|
|
56
|
+
id: params.pmids,
|
|
57
|
+
retmode: 'xml',
|
|
58
|
+
rettype: 'abstract',
|
|
59
|
+
});
|
|
60
|
+
const mode = params.authors ?? 'all';
|
|
61
|
+
const includeAffiliations = params.include_affiliations ?? false;
|
|
62
|
+
const articles = parsePubmedEfetchXml(xml).map((article) => ({
|
|
63
|
+
...article,
|
|
64
|
+
authors: selectAuthors(article.authors, mode).map((author) => includeAffiliations ? author : withoutAffiliations(author)),
|
|
65
|
+
}));
|
|
66
|
+
return {
|
|
67
|
+
articles,
|
|
68
|
+
count: articles.length,
|
|
69
|
+
important_legal_notice: IMPORTANT_LEGAL_NOTICE,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=getArticleMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getArticleMetadata.js","sourceRoot":"","sources":["../../src/tools/getArticleMetadata.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC;AAGrE,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACxB,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,kBAAkB,CAAC;SACvB,QAAQ,CACP,wDAAwD;QACtD,WAAW,kBAAkB,qBAAqB,CACrD;IACH,OA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,IAAI,KAAK,CAAC;IACrC,MAAM,mBAAmB,GAAG,MAAM,CAAC,oBAAoB,IAAI,KAAK,CAAC;IAEjE,MAAM,QAAQ,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC3D,GAAG,OAAO;QACV,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC3D,mBAAmB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAC3D;KACF,CAAC,CAAC,CAAC;IAEJ,OAAO;QACL,QAAQ;QACR,KAAK,EAAE,QAAQ,CAAC,MAAM;QACtB,sBAAsB,EAAE,sBAAsB;KAC/C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: get_copyright_status
|
|
3
|
+
*
|
|
4
|
+
* Check copyright and open-access status for PubMed articles.
|
|
5
|
+
* Maps PMIDs to PMCIDs with the NCBI ID Converter, then reads PMC's own
|
|
6
|
+
* access metadata from E-utilities EFetch (db=pmc). The PMC OA Web Service
|
|
7
|
+
* previously used here was retired by NCBI on 2026-08-25.
|
|
8
|
+
*
|
|
9
|
+
* has_full_text means get_full_text_article can return text for the article.
|
|
10
|
+
* It is false for PubMed-only articles and for PMC articles whose publisher
|
|
11
|
+
* does not allow full-text XML download.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
import type { NcbiClient } from '../pubmed/client.js';
|
|
15
|
+
import type { GetCopyrightStatusResponse } from '../pubmed/types.js';
|
|
16
|
+
/** PMIDs per request; the CLI splits longer lists into batches of this size. */
|
|
17
|
+
export declare const MAX_COPYRIGHT_PMIDS = 50;
|
|
18
|
+
export declare const getCopyrightStatusSchema: {
|
|
19
|
+
pmids: z.ZodArray<z.ZodString>;
|
|
20
|
+
};
|
|
21
|
+
export type GetCopyrightStatusParams = {
|
|
22
|
+
pmids: string[];
|
|
23
|
+
};
|
|
24
|
+
export declare function getCopyrightStatus(params: GetCopyrightStatusParams, client: NcbiClient): Promise<GetCopyrightStatusResponse>;
|
|
25
|
+
//# sourceMappingURL=getCopyrightStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCopyrightStatus.d.ts","sourceRoot":"","sources":["../../src/tools/getCopyrightStatus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,0BAA0B,EAAmB,MAAM,oBAAoB,CAAC;AAGtF,gFAAgF;AAChF,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,eAAO,MAAM,wBAAwB;;CAMpC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAKF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,wBAAwB,EAChC,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,0BAA0B,CAAC,CA4DrC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: get_copyright_status
|
|
3
|
+
*
|
|
4
|
+
* Check copyright and open-access status for PubMed articles.
|
|
5
|
+
* Maps PMIDs to PMCIDs with the NCBI ID Converter, then reads PMC's own
|
|
6
|
+
* access metadata from E-utilities EFetch (db=pmc). The PMC OA Web Service
|
|
7
|
+
* previously used here was retired by NCBI on 2026-08-25.
|
|
8
|
+
*
|
|
9
|
+
* has_full_text means get_full_text_article can return text for the article.
|
|
10
|
+
* It is false for PubMed-only articles and for PMC articles whose publisher
|
|
11
|
+
* does not allow full-text XML download.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
import { parsePmcAccessXml } from '../utils/xml.js';
|
|
15
|
+
/** PMIDs per request; the CLI splits longer lists into batches of this size. */
|
|
16
|
+
export const MAX_COPYRIGHT_PMIDS = 50;
|
|
17
|
+
export const getCopyrightStatusSchema = {
|
|
18
|
+
pmids: z
|
|
19
|
+
.array(z.string().min(1))
|
|
20
|
+
.min(1)
|
|
21
|
+
.max(MAX_COPYRIGHT_PMIDS)
|
|
22
|
+
.describe('Array of PubMed IDs (PMIDs) to check copyright status for.'),
|
|
23
|
+
};
|
|
24
|
+
/** Open-access articles come back as full JATS XML, so keep each EFetch modest. */
|
|
25
|
+
const EFETCH_BATCH_SIZE = 20;
|
|
26
|
+
export async function getCopyrightStatus(params, client) {
|
|
27
|
+
// Step 1: Convert PMIDs to PMCIDs using the ID Converter
|
|
28
|
+
const convResponse = await client.idConvert({
|
|
29
|
+
ids: params.pmids,
|
|
30
|
+
idtype: 'pmid',
|
|
31
|
+
});
|
|
32
|
+
// Build a map: pmid → pmcid (may be undefined if not in PMC)
|
|
33
|
+
const pmidToPmcid = new Map();
|
|
34
|
+
for (const record of convResponse.records) {
|
|
35
|
+
const pmid = record.pmid ?? record['requested-id'];
|
|
36
|
+
if (pmid) {
|
|
37
|
+
pmidToPmcid.set(String(pmid), record.pmcid);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Step 2: Fetch PMC records in batches and read their access metadata.
|
|
41
|
+
// Batches run sequentially so large inputs respect NCBI rate limits.
|
|
42
|
+
const pmcids = [
|
|
43
|
+
...new Set(params.pmids.map((pmid) => pmidToPmcid.get(pmid)).filter(isString)),
|
|
44
|
+
];
|
|
45
|
+
const accessByPmcid = new Map();
|
|
46
|
+
for (let i = 0; i < pmcids.length; i += EFETCH_BATCH_SIZE) {
|
|
47
|
+
const batch = pmcids.slice(i, i + EFETCH_BATCH_SIZE);
|
|
48
|
+
const xml = await client.efetch({
|
|
49
|
+
db: 'pmc',
|
|
50
|
+
id: batch.map((pmcid) => pmcid.replace(/^PMC/i, '')),
|
|
51
|
+
retmode: 'xml',
|
|
52
|
+
});
|
|
53
|
+
for (const info of parsePmcAccessXml(xml)) {
|
|
54
|
+
accessByPmcid.set(info.pmcid.toUpperCase(), info);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const statuses = params.pmids.map((pmid) => {
|
|
58
|
+
const pmcid = pmidToPmcid.get(pmid);
|
|
59
|
+
if (!pmcid) {
|
|
60
|
+
return { pmid, has_full_text: false };
|
|
61
|
+
}
|
|
62
|
+
const info = accessByPmcid.get(pmcid.toUpperCase());
|
|
63
|
+
if (!info) {
|
|
64
|
+
// In PMC per the ID Converter, but EFetch returned no record for it.
|
|
65
|
+
return { pmid, pmcid, has_full_text: false };
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
pmid,
|
|
69
|
+
pmcid,
|
|
70
|
+
has_full_text: info.hasFullText,
|
|
71
|
+
...(info.license ? { license: info.license } : {}),
|
|
72
|
+
...(info.copyrightStatement ? { copyright_statement: info.copyrightStatement } : {}),
|
|
73
|
+
is_open_access: info.isOpenAccess,
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
statuses,
|
|
78
|
+
count: statuses.length,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function isString(value) {
|
|
82
|
+
return typeof value === 'string' && value !== '';
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=getCopyrightStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCopyrightStatus.js","sourceRoot":"","sources":["../../src/tools/getCopyrightStatus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,iBAAiB,EAAsB,MAAM,iBAAiB,CAAC;AAExE,gFAAgF;AAChF,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;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AAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACpF,cAAc,EAAE,IAAI,CAAC,YAAY;SAClC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ;QACR,KAAK,EAAE,QAAQ,CAAC,MAAM;KACvB,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,KAAyB;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: get_full_text_article
|
|
3
|
+
*
|
|
4
|
+
* Retrieve the full text of articles from PubMed Central (PMC).
|
|
5
|
+
* Full text is available for PMC articles whose publisher allows full-text
|
|
6
|
+
* download (the same test get_copyright_status uses for has_full_text).
|
|
7
|
+
* Articles not in PMC will return an error entry.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import type { NcbiClient } from '../pubmed/client.js';
|
|
11
|
+
import type { GetFullTextArticleResponse } from '../pubmed/types.js';
|
|
12
|
+
/** PMCIDs per request; the CLI splits longer lists into batches of this size. */
|
|
13
|
+
export declare const MAX_FULL_TEXT_IDS = 20;
|
|
14
|
+
export declare const getFullTextArticleSchema: {
|
|
15
|
+
pmc_ids: z.ZodArray<z.ZodString>;
|
|
16
|
+
};
|
|
17
|
+
export type GetFullTextArticleParams = {
|
|
18
|
+
pmc_ids: string[];
|
|
19
|
+
};
|
|
20
|
+
export declare function getFullTextArticle(params: GetFullTextArticleParams, client: NcbiClient): Promise<GetFullTextArticleResponse>;
|
|
21
|
+
//# sourceMappingURL=getFullTextArticle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFullTextArticle.d.ts","sourceRoot":"","sources":["../../src/tools/getFullTextArticle.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,0BAA0B,EAAmB,MAAM,oBAAoB,CAAC;AAItF,iFAAiF;AACjF,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,eAAO,MAAM,wBAAwB;;CAWpC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAYF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,wBAAwB,EAChC,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,0BAA0B,CAAC,CA6DrC"}
|