@cyanheads/biorxiv-mcp-server 0.2.6 → 0.2.8
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/AGENTS.md +51 -24
- package/CLAUDE.md +51 -24
- package/Dockerfile +9 -7
- package/README.md +76 -60
- package/changelog/0.2.x/0.2.7.md +35 -0
- package/changelog/0.2.x/0.2.8.md +26 -0
- package/changelog/template.md +9 -26
- package/dist/config/server-config.d.ts +8 -6
- package/dist/config/server-config.d.ts.map +1 -1
- package/dist/config/server-config.js +10 -12
- package/dist/config/server-config.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.d.ts +18 -5
- package/dist/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.js +87 -33
- package/dist/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-preprint.tool.d.ts +4 -2
- package/dist/mcp-server/tools/definitions/biorxiv-get-preprint.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-preprint.tool.js +19 -12
- package/dist/mcp-server/tools/definitions/biorxiv-get-preprint.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-published-version.tool.d.ts +19 -9
- package/dist/mcp-server/tools/definitions/biorxiv-get-published-version.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-published-version.tool.js +125 -40
- package/dist/mcp-server/tools/definitions/biorxiv-get-published-version.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-list-categories.tool.js +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-list-categories.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-list-recent.tool.d.ts +5 -2
- package/dist/mcp-server/tools/definitions/biorxiv-list-recent.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-list-recent.tool.js +76 -47
- package/dist/mcp-server/tools/definitions/biorxiv-list-recent.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-search-preprints.tool.d.ts +12 -1
- package/dist/mcp-server/tools/definitions/biorxiv-search-preprints.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-search-preprints.tool.js +33 -6
- package/dist/mcp-server/tools/definitions/biorxiv-search-preprints.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +30 -11
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/services/biorxiv/biorxiv-service.d.ts +27 -4
- package/dist/services/biorxiv/biorxiv-service.d.ts.map +1 -1
- package/dist/services/biorxiv/biorxiv-service.js +105 -47
- package/dist/services/biorxiv/biorxiv-service.js.map +1 -1
- package/dist/services/biorxiv/types.d.ts +5 -0
- package/dist/services/biorxiv/types.d.ts.map +1 -1
- package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.d.ts +6 -3
- package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.d.ts.map +1 -1
- package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.js +6 -7
- package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.js.map +1 -1
- package/dist/services/europe-pmc/europe-pmc-service.d.ts +7 -3
- package/dist/services/europe-pmc/europe-pmc-service.d.ts.map +1 -1
- package/dist/services/europe-pmc/europe-pmc-service.js +55 -13
- package/dist/services/europe-pmc/europe-pmc-service.js.map +1 -1
- package/dist/services/shared.d.ts +23 -1
- package/dist/services/shared.d.ts.map +1 -1
- package/dist/services/shared.js +45 -1
- package/dist/services/shared.js.map +1 -1
- package/package.json +14 -13
- package/server.json +9 -3
|
@@ -3,10 +3,18 @@
|
|
|
3
3
|
* to its full journal publication record using the /pubs endpoint. Use when
|
|
4
4
|
* you need richer crosswalk metadata than biorxiv_get_preprint provides
|
|
5
5
|
* (journal name, published date, full abstract, corresponding author details).
|
|
6
|
-
* bioRxiv and medRxiv share
|
|
6
|
+
* bioRxiv and medRxiv share their DOI prefixes, so the DOI alone does not
|
|
7
7
|
* identify the server: the default server="both" resolves against both in
|
|
8
|
-
* parallel and the output names the server that answered.
|
|
9
|
-
*
|
|
8
|
+
* parallel and the output names the server that answered.
|
|
9
|
+
*
|
|
10
|
+
* `/pubs` keyed by preprint DOI never parses a `10.64898/` DOI, so when it
|
|
11
|
+
* answers empty everywhere the preprint's `/details` record supplies the journal
|
|
12
|
+
* DOI, and `/pubs` keyed by that journal DOI supplies the full record. When that
|
|
13
|
+
* reverse lookup finds nothing too, or fails, the
|
|
14
|
+
* journal DOI is returned alone with a notice — the journal name and date come
|
|
15
|
+
* only from the crosswalk and are never filled in from elsewhere. Not-found is
|
|
16
|
+
* reported only when every attempted server answered and the preprint lists no
|
|
17
|
+
* journal version, or no server holds it at all. A lookup
|
|
10
18
|
* the origin rate-limited (HTTP 429) raises a retryable `rate_limited` error
|
|
11
19
|
* carrying the origin's Retry-After wait rather than the generic
|
|
12
20
|
* upstream-unavailable one, which carries no wait at all.
|
|
@@ -15,29 +23,37 @@
|
|
|
15
23
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
16
24
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
17
25
|
import { getBiorxivApiService } from '../../../services/biorxiv/biorxiv-service.js';
|
|
18
|
-
import { describeWait, findRateLimit } from '../../../services/shared.js';
|
|
19
|
-
|
|
26
|
+
import { describeWait, findRateLimit, normalizeDoi } from '../../../services/shared.js';
|
|
27
|
+
function errorMessage(reason) {
|
|
28
|
+
return reason instanceof Error ? reason.message : String(reason);
|
|
29
|
+
}
|
|
20
30
|
export const biorxivGetPublishedVersionTool = tool('biorxiv_get_published_version', {
|
|
21
31
|
title: 'Get Published Journal Version',
|
|
22
|
-
description: 'Resolve a preprint DOI to its full journal publication record — journal DOI, journal name, published date, and corresponding author details. Use when the preprint\'s `publishedJournalDoi` field from biorxiv_get_preprint is present and you need the full crosswalk metadata. bioRxiv and medRxiv share
|
|
32
|
+
description: 'Resolve a preprint DOI to its full journal publication record — journal DOI, journal name, published date, and corresponding author details. Use when the preprint\'s `publishedJournalDoi` field from biorxiv_get_preprint is present and you need the full crosswalk metadata. bioRxiv and medRxiv share their DOI prefixes, so server="both" (the default) checks both in parallel and the response reports which server answered. Works for 10.1101/ and 10.64898/ DOIs alike; when the crosswalk holds no record for a published preprint, the journal DOI still comes back from the preprint\'s own record, without journal name or date, and a notice says so. Returns a not-found error only when no server holds the preprint or it lists no journal version at all.',
|
|
23
33
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
24
34
|
input: z.object({
|
|
25
35
|
doi: z
|
|
26
36
|
.string()
|
|
27
|
-
.describe('Preprint DOI to resolve (e.g. 10.1101/2024.01.15.575123 or 10.64898/2026.05.07.723463).'),
|
|
37
|
+
.describe('Preprint DOI to resolve (e.g. 10.1101/2024.01.15.575123 or 10.64898/2026.05.07.723463). A doi.org or biorxiv.org/medrxiv.org article URL, a doi: prefix, or a vN / .full suffix is accepted and stripped to the bare DOI.'),
|
|
28
38
|
server: z
|
|
29
39
|
.enum(['biorxiv', 'medrxiv', 'both'])
|
|
30
40
|
.default('both')
|
|
31
41
|
.describe('Server the preprint was posted on. "both" (default) checks bioRxiv and medRxiv in parallel — use it when the DOI alone does not tell you which server holds the preprint.'),
|
|
32
42
|
}),
|
|
33
43
|
output: z.object({
|
|
34
|
-
preprintDoi: z.string().describe('The preprint DOI that was resolved.'),
|
|
44
|
+
preprintDoi: z.string().describe('The preprint DOI that was resolved, in bare form.'),
|
|
35
45
|
server: z
|
|
36
46
|
.enum(['biorxiv', 'medrxiv'])
|
|
37
47
|
.describe('The server that returned this published record — never "both".'),
|
|
38
48
|
publishedDoi: z.string().optional().describe('The journal publication DOI.'),
|
|
39
|
-
publishedJournal: z
|
|
40
|
-
|
|
49
|
+
publishedJournal: z
|
|
50
|
+
.string()
|
|
51
|
+
.optional()
|
|
52
|
+
.describe('Name of the publishing journal. Absent when the crosswalk holds no record for this preprint — see notice.'),
|
|
53
|
+
publishedDate: z
|
|
54
|
+
.string()
|
|
55
|
+
.optional()
|
|
56
|
+
.describe('Journal publication date (YYYY-MM-DD). Absent when the crosswalk holds no record for this preprint — see notice.'),
|
|
41
57
|
preprintTitle: z.string().optional().describe('Title of the preprint.'),
|
|
42
58
|
preprintAuthors: z.string().optional().describe('Preprint author list.'),
|
|
43
59
|
preprintCategory: z.string().optional().describe('Subject category.'),
|
|
@@ -49,31 +65,39 @@ export const biorxivGetPublishedVersionTool = tool('biorxiv_get_published_versio
|
|
|
49
65
|
.optional()
|
|
50
66
|
.describe('Corresponding author institution.'),
|
|
51
67
|
}),
|
|
68
|
+
// Qualifies a record the crosswalk could not supply in full. Populated via
|
|
69
|
+
// ctx.enrich so it reaches both structuredContent and content[].
|
|
70
|
+
enrichment: {
|
|
71
|
+
notice: z
|
|
72
|
+
.string()
|
|
73
|
+
.optional()
|
|
74
|
+
.describe("Present when publishedDoi came from the preprint's own record because the crosswalk had none: says why publishedJournal and publishedDate are absent."),
|
|
75
|
+
},
|
|
52
76
|
errors: [
|
|
53
77
|
{
|
|
54
78
|
reason: 'doi_not_found',
|
|
55
79
|
code: JsonRpcErrorCode.NotFound,
|
|
56
|
-
when: '
|
|
57
|
-
recovery: 'Retry with server="both" if you scoped to one server
|
|
80
|
+
when: 'No attempted server holds the preprint, or neither the crosswalk nor its preprint record lists a journal version.',
|
|
81
|
+
recovery: 'Retry with server="both" if you scoped to one server; otherwise no journal version is recorded for this preprint yet — confirm the DOI with biorxiv_get_preprint or check again later.',
|
|
58
82
|
},
|
|
59
83
|
{
|
|
60
84
|
reason: 'invalid_doi_format',
|
|
61
85
|
code: JsonRpcErrorCode.ValidationError,
|
|
62
|
-
when: 'The input DOI does not match the 10.NNNN/ pattern.',
|
|
86
|
+
when: 'The input DOI does not match the 10.NNNN/ pattern, even after URL, doi:, and suffix stripping.',
|
|
63
87
|
recovery: 'Correct the DOI format — bioRxiv DOIs start with 10.1101/ or 10.64898/ followed by the manuscript ID.',
|
|
64
88
|
},
|
|
65
89
|
{
|
|
66
90
|
reason: 'upstream_unavailable',
|
|
67
91
|
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
68
92
|
retryable: true,
|
|
69
|
-
when: 'No
|
|
93
|
+
when: 'No published record was established and at least one crosswalk or preprint lookup failed against api.biorxiv.org.',
|
|
70
94
|
recovery: 'Retry the request after a short delay — a published version may well exist; api.biorxiv.org did not answer.',
|
|
71
95
|
},
|
|
72
96
|
{
|
|
73
97
|
reason: 'rate_limited',
|
|
74
98
|
code: JsonRpcErrorCode.RateLimited,
|
|
75
99
|
retryable: true,
|
|
76
|
-
when: 'No
|
|
100
|
+
when: 'No published record was established and at least one crosswalk or preprint lookup was rejected with HTTP 429 by api.biorxiv.org.',
|
|
77
101
|
recovery: 'Wait the retryAfter seconds before retrying — every preprint metadata tool queries the same origin, so none of them will answer sooner.',
|
|
78
102
|
},
|
|
79
103
|
],
|
|
@@ -82,47 +106,108 @@ export const biorxivGetPublishedVersionTool = tool('biorxiv_get_published_versio
|
|
|
82
106
|
doi: input.doi,
|
|
83
107
|
server: input.server,
|
|
84
108
|
});
|
|
85
|
-
|
|
109
|
+
const doi = normalizeDoi(input.doi)?.doi;
|
|
110
|
+
if (!doi) {
|
|
86
111
|
throw ctx.fail('invalid_doi_format', `Invalid DOI format: ${input.doi}`, {
|
|
87
112
|
...ctx.recoveryFor('invalid_doi_format'),
|
|
88
113
|
});
|
|
89
114
|
}
|
|
90
115
|
const service = getBiorxivApiService();
|
|
91
116
|
const servers = input.server === 'both' ? ['biorxiv', 'medrxiv'] : [input.server];
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
// A rate limit outranks a generic upstream failure: both say "retry", but
|
|
106
|
-
// only one says when, and retrying sooner would land inside the same limit.
|
|
117
|
+
/**
|
|
118
|
+
* "Not published" and "not found" are claims about what the servers
|
|
119
|
+
* reported, so a lookup that never answered leaves them unestablished and
|
|
120
|
+
* the call retryable. A rate limit outranks a generic upstream failure: both
|
|
121
|
+
* say "retry", but only one says when, and retrying sooner would land
|
|
122
|
+
* inside the same limit.
|
|
123
|
+
*/
|
|
124
|
+
const lookupFailure = (lookup, settled) => {
|
|
125
|
+
const rejections = settled.flatMap((r, i) => r.status === 'rejected' ? [{ server: servers[i], error: r.reason }] : []);
|
|
126
|
+
if (rejections.length === 0)
|
|
127
|
+
return;
|
|
128
|
+
const detail = rejections.map((f) => `${f.server}: ${errorMessage(f.error)}`).join('; ');
|
|
129
|
+
const failedServers = rejections.map((f) => f.server);
|
|
107
130
|
const rateLimit = findRateLimit(rejections.map((f) => f.error));
|
|
108
131
|
if (rateLimit) {
|
|
109
132
|
const wait = describeWait(rateLimit.retryAfter);
|
|
110
|
-
|
|
111
|
-
doi
|
|
112
|
-
servers:
|
|
133
|
+
return ctx.fail('rate_limited', `${lookup} for ${doi} failed — ${detail}`, {
|
|
134
|
+
doi,
|
|
135
|
+
servers: failedServers,
|
|
113
136
|
...(rateLimit.retryAfter !== undefined && { retryAfter: rateLimit.retryAfter }),
|
|
114
137
|
recovery: {
|
|
115
138
|
hint: `Wait ${wait} before retrying — api.biorxiv.org is rate-limiting this host, and every preprint metadata tool queries the same origin.`,
|
|
116
139
|
},
|
|
117
140
|
}, { cause: rejections[0]?.error });
|
|
118
141
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
142
|
+
return ctx.fail('upstream_unavailable', `${lookup} for ${doi} failed — ${detail}`, { doi, servers: failedServers, ...ctx.recoveryFor('upstream_unavailable') }, { cause: rejections[0]?.error });
|
|
143
|
+
};
|
|
144
|
+
// 1. The crosswalk keyed by preprint DOI — resolves 10.1101/ DOIs directly.
|
|
145
|
+
const crosswalk = await Promise.allSettled(servers.map((server) => service.getPublishedVersion(doi, server, ctx)));
|
|
146
|
+
for (const [i, result] of crosswalk.entries()) {
|
|
147
|
+
if (result.status === 'fulfilled' && result.value) {
|
|
148
|
+
return { ...result.value, server: servers[i] };
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const crosswalkFailure = lookupFailure('Crosswalk lookup', crosswalk);
|
|
152
|
+
if (crosswalkFailure)
|
|
153
|
+
throw crosswalkFailure;
|
|
154
|
+
// 2. The crosswalk answered empty everywhere, which is also its answer for
|
|
155
|
+
// every 10.64898/ DOI — the path form never parses one. The preprint's own
|
|
156
|
+
// /details record names its journal DOI whichever prefix it carries.
|
|
157
|
+
const details = await Promise.allSettled(servers.map((server) => service.getDetails(doi, server, ctx)));
|
|
158
|
+
const heldAt = details.findIndex((r) => r.status === 'fulfilled' && r.value.length > 0);
|
|
159
|
+
const held = details[heldAt];
|
|
160
|
+
if (held?.status !== 'fulfilled') {
|
|
161
|
+
const detailsFailure = lookupFailure('Preprint lookup', details);
|
|
162
|
+
if (detailsFailure)
|
|
163
|
+
throw detailsFailure;
|
|
164
|
+
// No preprint at all: the contract hint's "no journal version yet — check
|
|
165
|
+
// again later" would send the caller to wait on a DOI that does not exist.
|
|
166
|
+
throw ctx.fail('doi_not_found', `No preprint found for ${doi} on ${servers.join(' or ')}.`, {
|
|
167
|
+
doi,
|
|
168
|
+
servers,
|
|
169
|
+
recovery: {
|
|
170
|
+
hint: 'Retry with server="both" if you scoped to one server; otherwise the DOI is wrong — find the right one with biorxiv_search_preprints.',
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
const server = servers[heldAt];
|
|
175
|
+
const revisions = held.value;
|
|
176
|
+
const publishedDoi = revisions.findLast((r) => r.publishedJournalDoi)?.publishedJournalDoi;
|
|
177
|
+
if (!publishedDoi) {
|
|
178
|
+
throw ctx.fail('doi_not_found', `${doi} has no published journal version: neither the crosswalk nor its ${server} preprint record lists one.`, { doi, servers, ...ctx.recoveryFor('doi_not_found') });
|
|
179
|
+
}
|
|
180
|
+
// 3. The crosswalk keyed the other way, by that journal DOI — the full
|
|
181
|
+
// record, journal name and date included, whenever the API can parse the key.
|
|
182
|
+
const [byJournal] = await Promise.allSettled([
|
|
183
|
+
service.getPublishedVersionByJournalDoi(publishedDoi, doi, server, ctx),
|
|
184
|
+
]);
|
|
185
|
+
if (byJournal?.status === 'fulfilled' && byJournal.value) {
|
|
186
|
+
return { ...byJournal.value, server };
|
|
124
187
|
}
|
|
125
|
-
|
|
188
|
+
// 4. Only the journal DOI is established. The journal name and publication
|
|
189
|
+
// date come from the crosswalk alone, so they stay absent — never inferred.
|
|
190
|
+
ctx.enrich.notice(byJournal?.status === 'rejected'
|
|
191
|
+
? `The crosswalk lookup by journal DOI ${publishedDoi} failed (${errorMessage(byJournal.reason)}), so publishedDoi comes from the preprint's own record and the journal name and publication date are absent. Retry to fill them in.`
|
|
192
|
+
: `The crosswalk holds no record for ${doi} under its preprint DOI or its journal DOI ${publishedDoi}, so publishedDoi comes from the preprint's own record and the journal name and publication date — which only the crosswalk supplies — are absent. Resolve ${publishedDoi} at doi.org for the journal details.`);
|
|
193
|
+
const first = revisions[0];
|
|
194
|
+
const latest = revisions.at(-1);
|
|
195
|
+
return {
|
|
196
|
+
preprintDoi: doi,
|
|
197
|
+
server,
|
|
198
|
+
publishedDoi,
|
|
199
|
+
...(latest?.title && { preprintTitle: latest.title }),
|
|
200
|
+
...(latest?.authors && { preprintAuthors: latest.authors }),
|
|
201
|
+
...(latest?.category && { preprintCategory: latest.category }),
|
|
202
|
+
...(first?.date && { preprintDate: first.date }),
|
|
203
|
+
...(latest?.abstract && { preprintAbstract: latest.abstract }),
|
|
204
|
+
...(latest?.authorCorresponding && {
|
|
205
|
+
preprintAuthorCorresponding: latest.authorCorresponding,
|
|
206
|
+
}),
|
|
207
|
+
...(latest?.authorCorrespondingInstitution && {
|
|
208
|
+
preprintAuthorCorrespondingInstitution: latest.authorCorrespondingInstitution,
|
|
209
|
+
}),
|
|
210
|
+
};
|
|
126
211
|
},
|
|
127
212
|
format: (result) => {
|
|
128
213
|
const lines = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biorxiv-get-published-version.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-get-published-version.tool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"biorxiv-get-published-version.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-get-published-version.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAiB,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAE7E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEjF,SAAS,YAAY,CAAC,MAAe;IACnC,OAAO,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,CAAC,+BAA+B,EAAE;IAClF,KAAK,EAAE,+BAA+B;IACtC,WAAW,EACT,+uBAA+uB;IACjvB,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IAE9E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,GAAG,EAAE,CAAC;aACH,MAAM,EAAE;aACR,QAAQ,CACP,2NAA2N,CAC5N;QACH,MAAM,EAAE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AAC,gBAAgB;YAAE,KAAK,CAAC,IAAI,CAAC,iBAAiB,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;QACpF,IAAI,MAAM,CAAC,YAAY;YAAE,KAAK,CAAC,IAAI,CAAC,sBAAsB,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;QACjF,IAAI,MAAM,CAAC,2BAA2B;YACpC,KAAK,CAAC,IAAI,CAAC,6BAA6B,MAAM,CAAC,2BAA2B,EAAE,CAAC,CAAC;QAChF,IAAI,MAAM,CAAC,sCAAsC;YAC/C,KAAK,CAAC,IAAI,CAAC,oBAAoB,MAAM,CAAC,sCAAsC,EAAE,CAAC,CAAC;QAClF,IAAI,MAAM,CAAC,gBAAgB;YAAE,KAAK,CAAC,IAAI,CAAC,oBAAoB,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;QACvF,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
|
9
9
|
import { getBiorxivApiService } from '../../../services/biorxiv/biorxiv-service.js';
|
|
10
10
|
export const biorxivListCategoriesTool = tool('biorxiv_list_categories', {
|
|
11
11
|
title: 'List bioRxiv/medRxiv Categories',
|
|
12
|
-
description: 'List valid subject category strings for bioRxiv and medRxiv. Use these strings as the `category` filter in biorxiv_list_recent to narrow results to a specific field. Run this tool before filtering to get the current valid values.',
|
|
12
|
+
description: 'List valid subject category strings for bioRxiv and medRxiv — the categories the listing API actually filters on. Use these strings as the `category` filter in biorxiv_list_recent to narrow results to a specific field; case, and "_" or "-" in place of a space, do not matter there. Run this tool before filtering to get the current valid values.',
|
|
13
13
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
|
|
14
14
|
input: z.object({}),
|
|
15
15
|
output: z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biorxiv-list-categories.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-list-categories.tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAE7E,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC,yBAAyB,EAAE;IACvE,KAAK,EAAE,iCAAiC;IACxC,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"biorxiv-list-categories.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-list-categories.tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAE7E,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC,yBAAyB,EAAE;IACvE,KAAK,EAAE,iCAAiC;IACxC,WAAW,EACT,2VAA2V;IAC7V,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE;IAE/E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IAEnB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,OAAO,EAAE,CAAC;aACP,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;aACnD,QAAQ,CAAC,4BAA4B,CAAC;QACzC,OAAO,EAAE,CAAC;aACP,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;aACnD,QAAQ,CAAC,4BAA4B,CAAC;KAC1C,CAAC;IAEF,OAAO,CAAC,MAAM,EAAE,GAAG;QACjB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QAClD,OAAO,oBAAoB,EAAE,CAAC,aAAa,EAAE,CAAC;IAChD,CAAC;IAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC;QAClB;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE;gBACJ,0BAA0B,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG;gBAClD,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC9C,EAAE;gBACF,0BAA0B,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG;gBAClD,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;aAC/C,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF;CACF,CAAC,CAAC"}
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* @fileoverview biorxiv_list_recent tool — lists preprints posted or revised
|
|
3
3
|
* within a date interval. Fans out to both bioRxiv and medRxiv when
|
|
4
4
|
* server="both". Category filtering is applied server-side via the ?category=
|
|
5
|
-
* query param
|
|
5
|
+
* query param, in the API's lowercase spelling. The API answers a category it
|
|
6
|
+
* does not filter on with its unfiltered listing (echoing category "all"), so
|
|
7
|
+
* such a leg is dropped with a notice, and a call left with no filtered page
|
|
8
|
+
* raises invalid_category. Returns 30 results per page (API-fixed); use cursor to paginate.
|
|
6
9
|
* When server="both", per-server pagination state is surfaced independently,
|
|
7
10
|
* including per-server cursor exhaustion: the two servers hold different result
|
|
8
11
|
* counts, so one cursor can be valid for one and past the end for the other.
|
|
@@ -76,7 +79,7 @@ export declare const biorxivListRecentTool: import("@cyanheads/mcp-ts-core").Too
|
|
|
76
79
|
}, {
|
|
77
80
|
readonly reason: "invalid_category";
|
|
78
81
|
readonly code: JsonRpcErrorCode.ValidationError;
|
|
79
|
-
readonly when: "The
|
|
82
|
+
readonly when: "The category is not in the requested server's taxonomy, or api.biorxiv.org ignored it and returned the unfiltered listing on every server that answered.";
|
|
80
83
|
readonly recovery: "Call biorxiv_list_categories to get valid category strings and retry.";
|
|
81
84
|
}, {
|
|
82
85
|
readonly reason: "upstream_unavailable";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biorxiv-list-recent.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-list-recent.tool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"biorxiv-list-recent.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-list-recent.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAwCjE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkdhC,CAAC"}
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* @fileoverview biorxiv_list_recent tool — lists preprints posted or revised
|
|
3
3
|
* within a date interval. Fans out to both bioRxiv and medRxiv when
|
|
4
4
|
* server="both". Category filtering is applied server-side via the ?category=
|
|
5
|
-
* query param
|
|
5
|
+
* query param, in the API's lowercase spelling. The API answers a category it
|
|
6
|
+
* does not filter on with its unfiltered listing (echoing category "all"), so
|
|
7
|
+
* such a leg is dropped with a notice, and a call left with no filtered page
|
|
8
|
+
* raises invalid_category. Returns 30 results per page (API-fixed); use cursor to paginate.
|
|
6
9
|
* When server="both", per-server pagination state is surfaced independently,
|
|
7
10
|
* including per-server cursor exhaustion: the two servers hold different result
|
|
8
11
|
* counts, so one cursor can be valid for one and past the end for the other.
|
|
@@ -65,8 +68,10 @@ function formatPreprint(p) {
|
|
|
65
68
|
}
|
|
66
69
|
export const biorxivListRecentTool = tool('biorxiv_list_recent', {
|
|
67
70
|
title: 'List Recent Preprints',
|
|
68
|
-
description: 'List preprints posted or revised within a date interval, optionally scoped to one server or a subject category. Returns 30 preprints per page (fixed by the API); pass `cursor` as an integer offset (0, 30, 60, …) to step through additional pages. When server="both" (default), per-server pagination state is returned separately — use each server\'s `cursor` field for independent advancement. One server failing under server="both" does not abort the call: the other server\'s page is still returned and the failed one is named in `failed[]`, marking the result set as partial rather than complete. Every attempted server failing is a different case and does abort the call, with a retryable upstream_unavailable (or rate_limited) error — an empty page would otherwise be indistinguishable from an interval that genuinely holds nothing. Call biorxiv_list_categories for valid category strings.',
|
|
71
|
+
description: 'List preprints posted or revised within a date interval, optionally scoped to one server or a subject category. Returns 30 preprints per page (fixed by the API); pass `cursor` as an integer offset (0, 30, 60, …) to step through additional pages. When server="both" (default), per-server pagination state is returned separately — use each server\'s `cursor` field for independent advancement. One server failing under server="both" does not abort the call: the other server\'s page is still returned and the failed one is named in `failed[]`, marking the result set as partial rather than complete. Every attempted server failing is a different case and does abort the call, with a retryable upstream_unavailable (or rate_limited) error — an empty page would otherwise be indistinguishable from an interval that genuinely holds nothing. Call biorxiv_list_categories for valid category strings; a server that answers a category filter with its unfiltered listing is left out with a notice, and invalid_category is raised when no server applied it.',
|
|
69
72
|
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
73
|
+
// biorxiv_search_preprints spells its date bounds date_from / date_to.
|
|
74
|
+
inputAliases: { date_from: 'start_date', date_to: 'end_date' },
|
|
70
75
|
input: z.object({
|
|
71
76
|
start_date: z.string().describe('Start of the date interval (YYYY-MM-DD).'),
|
|
72
77
|
end_date: z.string().describe('End of the date interval (YYYY-MM-DD).'),
|
|
@@ -77,7 +82,7 @@ export const biorxivListRecentTool = tool('biorxiv_list_recent', {
|
|
|
77
82
|
category: z
|
|
78
83
|
.string()
|
|
79
84
|
.optional()
|
|
80
|
-
.describe('Subject category filter. Use biorxiv_list_categories for valid values.'),
|
|
85
|
+
.describe('Subject category filter, matched case-insensitively with "_" and "-" read as a space — "Cell Biology", "cell biology", "cell_biology", and "cell-biology" are the same filter. Use biorxiv_list_categories for valid values.'),
|
|
81
86
|
cursor: z
|
|
82
87
|
.number()
|
|
83
88
|
.int()
|
|
@@ -157,7 +162,7 @@ export const biorxivListRecentTool = tool('biorxiv_list_recent', {
|
|
|
157
162
|
notice: z
|
|
158
163
|
.string()
|
|
159
164
|
.optional()
|
|
160
|
-
.describe('Guidance on how to read this result set: which servers did not answer, which cursors are past the end, and — when nothing came back — the applied filters and how to broaden them. All applicable qualifications are composed into one string.'),
|
|
165
|
+
.describe('Guidance on how to read this result set: which servers did not answer, which ignored the category filter (their unfiltered records are left out), which cursors are past the end, and — when nothing came back — the applied filters and how to broaden them. All applicable qualifications are composed into one string.'),
|
|
161
166
|
categoryNote: z
|
|
162
167
|
.string()
|
|
163
168
|
.optional()
|
|
@@ -173,7 +178,7 @@ export const biorxivListRecentTool = tool('biorxiv_list_recent', {
|
|
|
173
178
|
{
|
|
174
179
|
reason: 'invalid_category',
|
|
175
180
|
code: JsonRpcErrorCode.ValidationError,
|
|
176
|
-
when:
|
|
181
|
+
when: "The category is not in the requested server's taxonomy, or api.biorxiv.org ignored it and returned the unfiltered listing on every server that answered.",
|
|
177
182
|
recovery: 'Call biorxiv_list_categories to get valid category strings and retry.',
|
|
178
183
|
},
|
|
179
184
|
{
|
|
@@ -247,12 +252,22 @@ export const biorxivListRecentTool = tool('biorxiv_list_recent', {
|
|
|
247
252
|
};
|
|
248
253
|
}
|
|
249
254
|
let allPreprints = [];
|
|
255
|
+
// The API answers a category it does not filter on with its unfiltered
|
|
256
|
+
// listing, echoing category "all". That page is never returned as filtered:
|
|
257
|
+
// a leg that did so is dropped, and a call left with no filtered page fails.
|
|
258
|
+
const ignoredCategory = (servers) => ctx.fail('invalid_category', `api.biorxiv.org ignored category "${category}" on ${serverLabels(servers)} and returned its unfiltered listing, so no filtered page is available.`, {
|
|
259
|
+
category,
|
|
260
|
+
servers,
|
|
261
|
+
recovery: {
|
|
262
|
+
hint: `Omit category to page the unfiltered listing, or pick a different category from biorxiv_list_categories — api.biorxiv.org is not filtering on "${category}".`,
|
|
263
|
+
},
|
|
264
|
+
});
|
|
250
265
|
// When server="both" and a category is given, check membership per-server once.
|
|
251
266
|
// A category that exists in only one taxonomy (inBx !== inMx) collapses the
|
|
252
267
|
// request onto that server alone — querying the other would return an
|
|
253
268
|
// unfiltered page mixed in with the filtered one under a filtered-looking
|
|
254
|
-
// request. Shared categories (
|
|
255
|
-
//
|
|
269
|
+
// request. Shared categories (Pathology) and no-category requests still fan
|
|
270
|
+
// out to both servers.
|
|
256
271
|
const inBx = input.server === 'both' && !!category && service.isValidCategory(category, 'biorxiv');
|
|
257
272
|
const inMx = input.server === 'both' && !!category && service.isValidCategory(category, 'medrxiv');
|
|
258
273
|
const exclusiveServer = inBx === inMx ? undefined : inBx ? 'biorxiv' : 'medrxiv';
|
|
@@ -263,46 +278,59 @@ export const biorxivListRecentTool = tool('biorxiv_list_recent', {
|
|
|
263
278
|
: `Category "${category}" is specific to medRxiv — only medRxiv was queried. bioRxiv was not included because its taxonomy has no such category.`,
|
|
264
279
|
});
|
|
265
280
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
281
|
+
// One leg: an explicit server, or a "both" request collapsed onto the server
|
|
282
|
+
// owning a server-exclusive category.
|
|
283
|
+
const singleServer = exclusiveServer ?? (input.server === 'both' ? undefined : input.server);
|
|
284
|
+
if (singleServer) {
|
|
285
|
+
const r = await service.getListing(singleServer, input.start_date, input.end_date, input.cursor, category, ctx);
|
|
286
|
+
if (r.categoryIgnored)
|
|
287
|
+
throw ignoredCategory([singleServer]);
|
|
288
|
+
pagination[singleServer] = toPaginationEntry(r);
|
|
271
289
|
allPreprints = r.preprints;
|
|
272
290
|
}
|
|
273
|
-
else
|
|
291
|
+
else {
|
|
274
292
|
// Fan out to both servers. Any category here is shared by both taxonomies,
|
|
275
293
|
// so it applies to each; with no category both return unfiltered pages.
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
]
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
294
|
+
const settled = await Promise.allSettled(SERVERS.map((server) => service.getListing(server, input.start_date, input.end_date, input.cursor, category, ctx)));
|
|
295
|
+
// Servers that answered but ignored the category filter — their pages are
|
|
296
|
+
// unfiltered, so they are left out rather than mixed in with filtered ones.
|
|
297
|
+
const ignored = [];
|
|
298
|
+
for (const [i, result] of settled.entries()) {
|
|
299
|
+
const server = SERVERS[i];
|
|
300
|
+
if (result.status === 'rejected') {
|
|
301
|
+
ctx.log.warning(`${SERVER_LABEL[server]} listing failed`, {
|
|
302
|
+
error: String(result.reason),
|
|
303
|
+
});
|
|
304
|
+
failed.push({ server, error: errorMessage(result.reason) });
|
|
305
|
+
rejections.push(result.reason);
|
|
306
|
+
}
|
|
307
|
+
else if (result.value.categoryIgnored) {
|
|
308
|
+
ctx.log.warning(`${SERVER_LABEL[server]} ignored the category filter`, { category });
|
|
309
|
+
ignored.push(server);
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
pagination[server] = toPaginationEntry(result.value);
|
|
313
|
+
allPreprints.push(...result.value.preprints);
|
|
314
|
+
}
|
|
297
315
|
}
|
|
298
|
-
//
|
|
299
|
-
//
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
316
|
+
// Every server that answered ignored the filter: there is no filtered page
|
|
317
|
+
// to return, and retrying will not produce one.
|
|
318
|
+
if (ignored.length === SERVERS.length)
|
|
319
|
+
throw ignoredCategory(ignored);
|
|
320
|
+
// Nothing usable came back and at least one server never answered. An
|
|
321
|
+
// empty page here is not a result — it is the absence of one — and a
|
|
322
|
+
// caller branching on success-vs-error cannot tell the two apart from a
|
|
323
|
+
// notice string. Raise the same retryable error the other DOI-resolving
|
|
324
|
+
// tools raise for their own nothing-answered case: the server that failed
|
|
325
|
+
// may still return a filtered page on retry.
|
|
326
|
+
if (failed.length + ignored.length === SERVERS.length) {
|
|
327
|
+
const detail = [
|
|
328
|
+
...failed.map((f) => `${SERVER_LABEL[f.server]}: ${f.error}`),
|
|
329
|
+
...ignored.map((s) => `${SERVER_LABEL[s]} ignored the category filter "${category}"`),
|
|
330
|
+
].join('; ');
|
|
331
|
+
const message = ignored.length === 0
|
|
332
|
+
? `Neither bioRxiv nor medRxiv answered — ${detail}`
|
|
333
|
+
: `No server returned a usable page — ${detail}`;
|
|
306
334
|
const servers = failed.map((f) => f.server);
|
|
307
335
|
// A rate limit outranks a generic outage: both say "retry", but only one
|
|
308
336
|
// says when, and retrying sooner would land inside the same limit.
|
|
@@ -327,6 +355,12 @@ export const biorxivListRecentTool = tool('biorxiv_list_recent', {
|
|
|
327
355
|
const labels = serverLabels(failed.map((f) => f.server));
|
|
328
356
|
notices.push(`${labels} did not answer, so this result set is partial — it holds no ${labels} records. See failed[] for the error and retry to include them.`);
|
|
329
357
|
}
|
|
358
|
+
// An ignored filter answered, so it is not in failed[] and a retry will not
|
|
359
|
+
// change it — but its absent pagination entry needs the same explanation.
|
|
360
|
+
if (ignored.length > 0) {
|
|
361
|
+
const labels = serverLabels(ignored);
|
|
362
|
+
notices.push(`${labels} ignored the category filter "${category}" and returned its unfiltered listing, so its records were left out — only the filtered results are shown.`);
|
|
363
|
+
}
|
|
330
364
|
// One server's cursor overshot while the other still returned records. The
|
|
331
365
|
// fully-empty branch below does not fire, so without this nothing qualifies
|
|
332
366
|
// the exhausted server's total 0 — it reads as "no preprints in the interval".
|
|
@@ -335,11 +369,6 @@ export const biorxivListRecentTool = tool('biorxiv_list_recent', {
|
|
|
335
369
|
notices.push(`Cursor ${input.cursor} is past the last available page on ${serverLabels(exhaustedServers)} — that entry is marked exhausted and its total of 0 is an out-of-range artifact, not the interval total. Lower the cursor to page that server.`);
|
|
336
370
|
}
|
|
337
371
|
}
|
|
338
|
-
else {
|
|
339
|
-
const r = await service.getListing(input.server, input.start_date, input.end_date, input.cursor, category, ctx);
|
|
340
|
-
pagination[input.server] = toPaginationEntry(r);
|
|
341
|
-
allPreprints = r.preprints;
|
|
342
|
-
}
|
|
343
372
|
// "Nothing here" is a claim about what the servers reported, and by this point
|
|
344
373
|
// one has: every branch above either records a pagination entry or throws.
|
|
345
374
|
if (allPreprints.length === 0) {
|