@cyanheads/biorxiv-mcp-server 0.3.1 → 0.4.1
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 +17 -13
- package/CLAUDE.md +17 -13
- package/Dockerfile +3 -3
- package/README.md +34 -25
- package/changelog/0.4.x/0.4.0.md +33 -0
- package/changelog/0.4.x/0.4.1.md +27 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.d.ts +12 -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 +113 -29
- 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 +21 -9
- 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 +130 -49
- 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 +4 -2
- 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 +33 -20
- package/dist/mcp-server/tools/definitions/biorxiv-get-published-version.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-list-published-versions.tool.d.ts +102 -0
- package/dist/mcp-server/tools/definitions/biorxiv-list-published-versions.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/biorxiv-list-published-versions.tool.js +372 -0
- package/dist/mcp-server/tools/definitions/biorxiv-list-published-versions.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/biorxiv-list-recent.tool.d.ts +1 -1
- 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 +35 -21
- 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 +18 -6
- 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 +78 -48
- package/dist/mcp-server/tools/definitions/biorxiv-search-preprints.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +101 -15
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/index.js +3 -0
- package/dist/mcp-server/tools/definitions/index.js.map +1 -1
- package/dist/services/biorxiv/biorxiv-service.d.ts +33 -8
- package/dist/services/biorxiv/biorxiv-service.d.ts.map +1 -1
- package/dist/services/biorxiv/biorxiv-service.js +91 -24
- package/dist/services/biorxiv/biorxiv-service.js.map +1 -1
- package/dist/services/biorxiv/types.d.ts +25 -3
- package/dist/services/biorxiv/types.d.ts.map +1 -1
- package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.d.ts +22 -5
- package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.d.ts.map +1 -1
- package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.js +99 -17
- 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 +20 -13
- package/dist/services/europe-pmc/europe-pmc-service.js.map +1 -1
- package/dist/services/shared.d.ts +81 -5
- package/dist/services/shared.d.ts.map +1 -1
- package/dist/services/shared.js +130 -13
- package/dist/services/shared.js.map +1 -1
- package/package.json +8 -8
- package/server.json +3 -3
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview biorxiv_list_published_versions tool — lists the preprints
|
|
3
|
+
* that appeared as journal articles within a journal publication-date
|
|
4
|
+
* interval, each as the crosswalk record biorxiv_get_published_version returns
|
|
5
|
+
* for one DOI. The interval filters on the journal's publication date, so most
|
|
6
|
+
* rows were posted as preprints months or years before it — the rows
|
|
7
|
+
* biorxiv_list_recent, which filters on posting date, never reaches.
|
|
8
|
+
*
|
|
9
|
+
* Fans out to bioRxiv and medRxiv when server="both", with one input cursor
|
|
10
|
+
* and per-server pagination state: the servers hold different row counts, so
|
|
11
|
+
* one cursor can be inside one server's rows and past the end of the other's.
|
|
12
|
+
* The API serves 100 rows a page and takes no size parameter, so each server
|
|
13
|
+
* returns the first `limit` rows (default 25) of its page, sliced in the
|
|
14
|
+
* service before rows are normalized, and nextCursor advances by the upstream
|
|
15
|
+
* rows served; a limit above 100 serves the whole page and says so. Upstream
|
|
16
|
+
* answers an empty interval and a cursor at or past the last row identically —
|
|
17
|
+
* "no articles found", no total — so dates are validated before any call, a
|
|
18
|
+
* zero-row page at cursor 0 reports total 0, and one at a later cursor is
|
|
19
|
+
* flagged exhausted with no total rather than claiming the interval is empty.
|
|
20
|
+
*
|
|
21
|
+
* A server that did not answer is named in failed[] and the notice; when no
|
|
22
|
+
* server answered the call raises a retryable error instead of an empty page.
|
|
23
|
+
* Abstracts are about three quarters of a page and are omitted unless
|
|
24
|
+
* include_abstract is true; nothing else in a record changes.
|
|
25
|
+
* @module mcp-server/tools/definitions/biorxiv-list-published-versions.tool
|
|
26
|
+
*/
|
|
27
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
28
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
29
|
+
export declare const biorxivListPublishedVersionsTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
30
|
+
start_date: z.ZodString;
|
|
31
|
+
end_date: z.ZodString;
|
|
32
|
+
server: z.ZodDefault<z.ZodEnum<{
|
|
33
|
+
biorxiv: "biorxiv";
|
|
34
|
+
both: "both";
|
|
35
|
+
medrxiv: "medrxiv";
|
|
36
|
+
}>>;
|
|
37
|
+
cursor: z.ZodDefault<z.ZodNumber>;
|
|
38
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
39
|
+
include_abstract: z.ZodDefault<z.ZodBoolean>;
|
|
40
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
41
|
+
publications: z.ZodArray<z.ZodObject<{
|
|
42
|
+
server: z.ZodEnum<{
|
|
43
|
+
biorxiv: "biorxiv";
|
|
44
|
+
medrxiv: "medrxiv";
|
|
45
|
+
}>;
|
|
46
|
+
preprintDoi: z.ZodString;
|
|
47
|
+
publishedDoi: z.ZodOptional<z.ZodString>;
|
|
48
|
+
publishedJournal: z.ZodOptional<z.ZodString>;
|
|
49
|
+
publishedDate: z.ZodOptional<z.ZodString>;
|
|
50
|
+
preprintDate: z.ZodOptional<z.ZodString>;
|
|
51
|
+
preprintTitle: z.ZodOptional<z.ZodString>;
|
|
52
|
+
preprintAuthors: z.ZodOptional<z.ZodString>;
|
|
53
|
+
preprintCategory: z.ZodOptional<z.ZodString>;
|
|
54
|
+
preprintAuthorCorresponding: z.ZodOptional<z.ZodString>;
|
|
55
|
+
preprintAuthorCorrespondingInstitution: z.ZodOptional<z.ZodString>;
|
|
56
|
+
preprintAbstract: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
pagination: z.ZodObject<{
|
|
59
|
+
biorxiv: z.ZodOptional<z.ZodObject<{
|
|
60
|
+
cursor: z.ZodNumber;
|
|
61
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
nextCursor: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
exhausted: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
medrxiv: z.ZodOptional<z.ZodObject<{
|
|
66
|
+
cursor: z.ZodNumber;
|
|
67
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
nextCursor: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
exhausted: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
+
}, z.core.$strip>>;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
failed: z.ZodArray<z.ZodObject<{
|
|
73
|
+
server: z.ZodEnum<{
|
|
74
|
+
biorxiv: "biorxiv";
|
|
75
|
+
medrxiv: "medrxiv";
|
|
76
|
+
}>;
|
|
77
|
+
error: z.ZodString;
|
|
78
|
+
}, z.core.$strip>>;
|
|
79
|
+
}, z.core.$strip>, readonly [{
|
|
80
|
+
readonly reason: "invalid_date_range";
|
|
81
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
82
|
+
readonly when: "start_date or end_date is not a real calendar date (2024-02-30, 2024-13-01), or end_date is before start_date.";
|
|
83
|
+
readonly recovery: "Provide valid YYYY-MM-DD journal publication dates where start_date is on or before end_date.";
|
|
84
|
+
}, {
|
|
85
|
+
readonly reason: "upstream_unavailable";
|
|
86
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
87
|
+
readonly retryable: true;
|
|
88
|
+
readonly when: "Every attempted server failed against api.biorxiv.org, so no page was retrieved and an empty interval could not be established.";
|
|
89
|
+
readonly recovery: "Retry the request after a short delay — the interval may well hold publications; api.biorxiv.org did not answer.";
|
|
90
|
+
}, {
|
|
91
|
+
readonly reason: "rate_limited";
|
|
92
|
+
readonly code: JsonRpcErrorCode.RateLimited;
|
|
93
|
+
readonly retryable: true;
|
|
94
|
+
readonly when: "Every attempted server failed and at least one was rejected with HTTP 429 by api.biorxiv.org.";
|
|
95
|
+
readonly recovery: "Wait the retryAfter seconds when present, otherwise a minute or two, before retrying — every preprint metadata tool queries the same origin, so none of them will answer sooner.";
|
|
96
|
+
}], {
|
|
97
|
+
readonly notice: z.ZodOptional<z.ZodString>;
|
|
98
|
+
readonly truncated: z.ZodOptional<z.ZodBoolean>;
|
|
99
|
+
readonly shown: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
readonly cap: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
}>;
|
|
102
|
+
//# sourceMappingURL=biorxiv-list-published-versions.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"biorxiv-list-published-versions.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-list-published-versions.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAgFjE,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiX3C,CAAC"}
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview biorxiv_list_published_versions tool — lists the preprints
|
|
3
|
+
* that appeared as journal articles within a journal publication-date
|
|
4
|
+
* interval, each as the crosswalk record biorxiv_get_published_version returns
|
|
5
|
+
* for one DOI. The interval filters on the journal's publication date, so most
|
|
6
|
+
* rows were posted as preprints months or years before it — the rows
|
|
7
|
+
* biorxiv_list_recent, which filters on posting date, never reaches.
|
|
8
|
+
*
|
|
9
|
+
* Fans out to bioRxiv and medRxiv when server="both", with one input cursor
|
|
10
|
+
* and per-server pagination state: the servers hold different row counts, so
|
|
11
|
+
* one cursor can be inside one server's rows and past the end of the other's.
|
|
12
|
+
* The API serves 100 rows a page and takes no size parameter, so each server
|
|
13
|
+
* returns the first `limit` rows (default 25) of its page, sliced in the
|
|
14
|
+
* service before rows are normalized, and nextCursor advances by the upstream
|
|
15
|
+
* rows served; a limit above 100 serves the whole page and says so. Upstream
|
|
16
|
+
* answers an empty interval and a cursor at or past the last row identically —
|
|
17
|
+
* "no articles found", no total — so dates are validated before any call, a
|
|
18
|
+
* zero-row page at cursor 0 reports total 0, and one at a later cursor is
|
|
19
|
+
* flagged exhausted with no total rather than claiming the interval is empty.
|
|
20
|
+
*
|
|
21
|
+
* A server that did not answer is named in failed[] and the notice; when no
|
|
22
|
+
* server answered the call raises a retryable error instead of an empty page.
|
|
23
|
+
* Abstracts are about three quarters of a page and are omitted unless
|
|
24
|
+
* include_abstract is true; nothing else in a record changes.
|
|
25
|
+
* @module mcp-server/tools/definitions/biorxiv-list-published-versions.tool
|
|
26
|
+
*/
|
|
27
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
28
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
29
|
+
import { getBiorxivApiService } from '../../../services/biorxiv/biorxiv-service.js';
|
|
30
|
+
import { describeWait, escapeMarkdown, findRateLimit, isValidCalendarDate, startCallDeadline, } from '../../../services/shared.js';
|
|
31
|
+
const SERVERS = ['biorxiv', 'medrxiv'];
|
|
32
|
+
const SERVER_LABEL = { biorxiv: 'bioRxiv', medrxiv: 'medRxiv' };
|
|
33
|
+
/** Rows api.biorxiv.org serves per `/pubs` interval page — the most one call can return per server. */
|
|
34
|
+
const UPSTREAM_PAGE_ROWS = 100;
|
|
35
|
+
function errorMessage(reason) {
|
|
36
|
+
return reason instanceof Error ? reason.message : String(reason);
|
|
37
|
+
}
|
|
38
|
+
/** Human-facing server names for a notice sentence: "bioRxiv and medRxiv". */
|
|
39
|
+
function serverLabels(servers) {
|
|
40
|
+
return servers.map((s) => SERVER_LABEL[s]).join(' and ');
|
|
41
|
+
}
|
|
42
|
+
// Upstream free text is escaped as it is interpolated so it renders literally —
|
|
43
|
+
// the abstract opens its own line, where `1. ` would start a list. DOIs stay
|
|
44
|
+
// raw because agents copy them back into calls.
|
|
45
|
+
function formatPublication(p) {
|
|
46
|
+
const lines = [];
|
|
47
|
+
lines.push(`### ${p.preprintTitle ? escapeMarkdown(p.preprintTitle) : p.preprintDoi}`);
|
|
48
|
+
lines.push(`**Preprint DOI:** ${p.preprintDoi}`);
|
|
49
|
+
lines.push(`**Server:** ${p.server}`);
|
|
50
|
+
if (p.publishedDoi)
|
|
51
|
+
lines.push(`**Published DOI:** ${p.publishedDoi}`);
|
|
52
|
+
if (p.publishedJournal)
|
|
53
|
+
lines.push(`**Journal:** ${escapeMarkdown(p.publishedJournal)}`);
|
|
54
|
+
if (p.publishedDate)
|
|
55
|
+
lines.push(`**Published Date:** ${p.publishedDate}`);
|
|
56
|
+
if (p.preprintDate)
|
|
57
|
+
lines.push(`**Preprint Date:** ${p.preprintDate}`);
|
|
58
|
+
if (p.preprintCategory)
|
|
59
|
+
lines.push(`**Category:** ${escapeMarkdown(p.preprintCategory)}`);
|
|
60
|
+
if (p.preprintAuthors)
|
|
61
|
+
lines.push(`**Authors:** ${escapeMarkdown(p.preprintAuthors)}`);
|
|
62
|
+
if (p.preprintAuthorCorresponding)
|
|
63
|
+
lines.push(`**Corresponding Author:** ${escapeMarkdown(p.preprintAuthorCorresponding)}`);
|
|
64
|
+
if (p.preprintAuthorCorrespondingInstitution)
|
|
65
|
+
lines.push(`**Institution:** ${escapeMarkdown(p.preprintAuthorCorrespondingInstitution)}`);
|
|
66
|
+
if (p.preprintAbstract)
|
|
67
|
+
lines.push(`\n${escapeMarkdown(p.preprintAbstract)}`);
|
|
68
|
+
return lines.join('\n');
|
|
69
|
+
}
|
|
70
|
+
const paginationEntry = (label) => z
|
|
71
|
+
.object({
|
|
72
|
+
cursor: z.number().describe('Cursor (row offset) this page was requested at.'),
|
|
73
|
+
total: z
|
|
74
|
+
.number()
|
|
75
|
+
.optional()
|
|
76
|
+
.describe(`Journal publications on ${label} in the interval. Absent only when the entry is exhausted: ${label} reports no total for a cursor past its last row.`),
|
|
77
|
+
nextCursor: z
|
|
78
|
+
.number()
|
|
79
|
+
.optional()
|
|
80
|
+
.describe(`Cursor for the next page, when rows remain on ${label} past this one: this page's cursor plus the rows it served. Pass it as cursor to continue, at any limit.`),
|
|
81
|
+
exhausted: z
|
|
82
|
+
.boolean()
|
|
83
|
+
.optional()
|
|
84
|
+
.describe(`True when the cursor is at or past ${label}'s last row: no rows came back at a non-zero cursor. Lower the cursor to page ${label}.`),
|
|
85
|
+
})
|
|
86
|
+
.optional()
|
|
87
|
+
.describe(`${label} pagination state. Present when ${label} was queried and answered.`);
|
|
88
|
+
export const biorxivListPublishedVersionsTool = tool('biorxiv_list_published_versions', {
|
|
89
|
+
title: 'List Published Journal Versions',
|
|
90
|
+
description: 'List preprints that appeared as journal articles within a journal publication-date interval, each with its journal DOI, journal name, publication date, and preprint metadata — the same record biorxiv_get_published_version returns for one DOI. The dates filter on journal publication, not preprint posting, so most rows were posted months or years earlier; use biorxiv_list_recent for preprints posted in an interval. Returns `limit` publications per server (default 25, up to 100 — the page api.biorxiv.org serves; a larger limit returns 100 and says so). Continue at the `nextCursor` a page returns rather than stepping `cursor` by a fixed amount; `limit: 100` walks an interval in the fewest calls. When server="both" (default), per-server pagination state is returned separately, since one cursor can be past the end of one server and inside the other — to continue a single server, pass its `nextCursor` with `server` set to that server. 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[]`. Every attempted server failing raises a retryable upstream_unavailable (or rate_limited) error rather than an empty page. Abstracts are omitted by default to keep the page small — pass include_abstract: true for the whole page. Every preprintDoi, 10.1101/ and 10.64898/ alike, is accepted by biorxiv_get_preprint and the other DOI tools.',
|
|
91
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
92
|
+
// biorxiv_search_preprints spells its date bounds date_from / date_to.
|
|
93
|
+
inputAliases: { date_from: 'start_date', date_to: 'end_date' },
|
|
94
|
+
input: z.object({
|
|
95
|
+
start_date: z
|
|
96
|
+
.string()
|
|
97
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/)
|
|
98
|
+
.describe('Start of the journal publication-date interval (YYYY-MM-DD), inclusive.'),
|
|
99
|
+
end_date: z
|
|
100
|
+
.string()
|
|
101
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/)
|
|
102
|
+
.describe('End of the journal publication-date interval (YYYY-MM-DD), inclusive.'),
|
|
103
|
+
server: z
|
|
104
|
+
.enum(['biorxiv', 'medrxiv', 'both'])
|
|
105
|
+
.default('both')
|
|
106
|
+
.describe('Preprint server to list. "both" lists bioRxiv and medRxiv in parallel; their rows do not overlap.'),
|
|
107
|
+
cursor: z
|
|
108
|
+
.number()
|
|
109
|
+
.int()
|
|
110
|
+
.min(0)
|
|
111
|
+
.default(0)
|
|
112
|
+
.describe('Integer row offset, applied to each queried server. Defaults to 0 (first page). To continue, pass the nextCursor the previous page returned for that server — it advances by the rows actually served.'),
|
|
113
|
+
limit: z
|
|
114
|
+
.number()
|
|
115
|
+
.int()
|
|
116
|
+
.min(1)
|
|
117
|
+
.max(1000)
|
|
118
|
+
.default(25)
|
|
119
|
+
.describe('Rows to return per queried server, starting at cursor. Defaults to 25. Up to 100, the page api.biorxiv.org serves: a larger value returns 100 rows per server and says so in the notice. limit: 100 walks an interval in the fewest calls.'),
|
|
120
|
+
include_abstract: z
|
|
121
|
+
.boolean()
|
|
122
|
+
.default(false)
|
|
123
|
+
.describe("Include each preprint's abstract. Defaults to false: abstracts make up about three quarters of a page, and every other field is returned either way."),
|
|
124
|
+
}),
|
|
125
|
+
output: z.object({
|
|
126
|
+
publications: z
|
|
127
|
+
.array(z
|
|
128
|
+
.object({
|
|
129
|
+
server: z
|
|
130
|
+
.enum(['biorxiv', 'medrxiv'])
|
|
131
|
+
.describe('Preprint server that listed this publication.'),
|
|
132
|
+
preprintDoi: z
|
|
133
|
+
.string()
|
|
134
|
+
.describe('Preprint DOI — input to biorxiv_get_preprint and the other DOI tools.'),
|
|
135
|
+
publishedDoi: z.string().optional().describe('Journal article DOI.'),
|
|
136
|
+
publishedJournal: z.string().optional().describe('Name of the publishing journal.'),
|
|
137
|
+
publishedDate: z
|
|
138
|
+
.string()
|
|
139
|
+
.optional()
|
|
140
|
+
.describe('Journal publication date (YYYY-MM-DD), within the requested interval.'),
|
|
141
|
+
preprintDate: z
|
|
142
|
+
.string()
|
|
143
|
+
.optional()
|
|
144
|
+
.describe('Preprint posting date (YYYY-MM-DD) as this row records it — the first posting for most preprints. medRxiv lists some 10.64898/ preprints on two rows that differ in this date, and sometimes in title or authors; both rows are returned. Not derivable from the DOI.'),
|
|
145
|
+
preprintTitle: z.string().optional().describe('Title of the preprint.'),
|
|
146
|
+
preprintAuthors: z.string().optional().describe('Preprint author list.'),
|
|
147
|
+
preprintCategory: z.string().optional().describe('Subject category.'),
|
|
148
|
+
preprintAuthorCorresponding: z
|
|
149
|
+
.string()
|
|
150
|
+
.optional()
|
|
151
|
+
.describe('Corresponding author name.'),
|
|
152
|
+
preprintAuthorCorrespondingInstitution: z
|
|
153
|
+
.string()
|
|
154
|
+
.optional()
|
|
155
|
+
.describe('Corresponding author institution.'),
|
|
156
|
+
preprintAbstract: z
|
|
157
|
+
.string()
|
|
158
|
+
.optional()
|
|
159
|
+
.describe('Preprint abstract. Present only when include_abstract is true.'),
|
|
160
|
+
})
|
|
161
|
+
.describe('One preprint and the journal article it became.'))
|
|
162
|
+
.describe('Publications in the interval, in upstream order: bioRxiv rows first, then medRxiv rows.'),
|
|
163
|
+
pagination: z
|
|
164
|
+
.object({
|
|
165
|
+
biorxiv: paginationEntry('bioRxiv'),
|
|
166
|
+
medrxiv: paginationEntry('medRxiv'),
|
|
167
|
+
})
|
|
168
|
+
.describe('Per-server pagination state. Advance each server independently.'),
|
|
169
|
+
failed: z
|
|
170
|
+
.array(z
|
|
171
|
+
.object({
|
|
172
|
+
server: z.enum(['biorxiv', 'medrxiv']).describe('Server whose request failed.'),
|
|
173
|
+
error: z.string().describe('What went wrong on that server.'),
|
|
174
|
+
})
|
|
175
|
+
.describe('A server that did not answer.'))
|
|
176
|
+
.describe('Servers that did not answer, so their rows are missing from "publications" and they have no "pagination" entry. Non-empty means this result set is partial — retry to include them. Only populated under server="both", and never holding every attempted server: when none answered, the call fails with upstream_unavailable or rate_limited instead. Distinct from an exhausted pagination entry, where the server answered.'),
|
|
177
|
+
}),
|
|
178
|
+
// Agent-facing context on the success path. Populated via ctx.enrich so it
|
|
179
|
+
// reaches both structuredContent and content[]; never rides in the domain return.
|
|
180
|
+
enrichment: {
|
|
181
|
+
notice: z
|
|
182
|
+
.string()
|
|
183
|
+
.optional()
|
|
184
|
+
.describe('Guidance on how to read this result set: which servers did not answer, a limit above the 100-row page, which cursors are past the end, which servers have rows past this page, and — when nothing came back — the interval and how to broaden it. All applicable qualifications are composed into one string.'),
|
|
185
|
+
truncated: z
|
|
186
|
+
.boolean()
|
|
187
|
+
.optional()
|
|
188
|
+
.describe("True when at least one server has rows past this page — continue at that server's nextCursor. Absent when every server queried is on its last page."),
|
|
189
|
+
shown: z
|
|
190
|
+
.number()
|
|
191
|
+
.optional()
|
|
192
|
+
.describe('Publications on this page, across every server queried. Set with truncated.'),
|
|
193
|
+
cap: z
|
|
194
|
+
.number()
|
|
195
|
+
.optional()
|
|
196
|
+
.describe('Most publications this page can hold: rows per server (limit, or 100 when limit asked for more) times the servers queried. Set with truncated.'),
|
|
197
|
+
},
|
|
198
|
+
errors: [
|
|
199
|
+
{
|
|
200
|
+
reason: 'invalid_date_range',
|
|
201
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
202
|
+
when: 'start_date or end_date is not a real calendar date (2024-02-30, 2024-13-01), or end_date is before start_date.',
|
|
203
|
+
recovery: 'Provide valid YYYY-MM-DD journal publication dates where start_date is on or before end_date.',
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
reason: 'upstream_unavailable',
|
|
207
|
+
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
208
|
+
retryable: true,
|
|
209
|
+
when: 'Every attempted server failed against api.biorxiv.org, so no page was retrieved and an empty interval could not be established.',
|
|
210
|
+
recovery: 'Retry the request after a short delay — the interval may well hold publications; api.biorxiv.org did not answer.',
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
reason: 'rate_limited',
|
|
214
|
+
code: JsonRpcErrorCode.RateLimited,
|
|
215
|
+
retryable: true,
|
|
216
|
+
when: 'Every attempted server failed and at least one was rejected with HTTP 429 by api.biorxiv.org.',
|
|
217
|
+
recovery: 'Wait the retryAfter seconds when present, otherwise a minute or two, before retrying — every preprint metadata tool queries the same origin, so none of them will answer sooner.',
|
|
218
|
+
},
|
|
219
|
+
],
|
|
220
|
+
async handler(input, ctx) {
|
|
221
|
+
ctx.log.info('Executing biorxiv_list_published_versions', {
|
|
222
|
+
start_date: input.start_date,
|
|
223
|
+
end_date: input.end_date,
|
|
224
|
+
server: input.server,
|
|
225
|
+
cursor: input.cursor,
|
|
226
|
+
limit: input.limit,
|
|
227
|
+
});
|
|
228
|
+
// Upstream answers a malformed or inverted interval with HTTP 200 and an
|
|
229
|
+
// empty page. The schema holds both bounds to YYYY-MM-DD; what it cannot
|
|
230
|
+
// see is a real calendar date (2024-02-30 has the shape) or the order.
|
|
231
|
+
if (!isValidCalendarDate(input.start_date) || !isValidCalendarDate(input.end_date)) {
|
|
232
|
+
throw ctx.fail('invalid_date_range', 'Date must be a real calendar date (YYYY-MM-DD).');
|
|
233
|
+
}
|
|
234
|
+
if (input.start_date > input.end_date) {
|
|
235
|
+
throw ctx.fail('invalid_date_range', `start_date (${input.start_date}) must be on or before end_date (${input.end_date}).`);
|
|
236
|
+
}
|
|
237
|
+
const service = getBiorxivApiService();
|
|
238
|
+
const deadline = startCallDeadline();
|
|
239
|
+
const servers = input.server === 'both' ? SERVERS : [input.server];
|
|
240
|
+
const limit = Math.min(input.limit, UPSTREAM_PAGE_ROWS);
|
|
241
|
+
const settled = await Promise.allSettled(servers.map((server) => service.getPublishedListing(server, input.start_date, input.end_date, input.cursor, limit, deadline, ctx)));
|
|
242
|
+
// A cancelled call is not a partial result, whichever leg the abort reached first.
|
|
243
|
+
ctx.signal.throwIfAborted();
|
|
244
|
+
const pagination = {};
|
|
245
|
+
const failed = [];
|
|
246
|
+
const rejections = [];
|
|
247
|
+
let publications = [];
|
|
248
|
+
// Counted in upstream rows, never the normalized ones: the service drops a
|
|
249
|
+
// row naming no preprint, and the next page still starts past it. Zero rows
|
|
250
|
+
// at a non-zero cursor means the cursor reached this server's end, where
|
|
251
|
+
// upstream reports no total; at cursor 0 the interval is empty.
|
|
252
|
+
let upstreamRows = 0;
|
|
253
|
+
function toPaginationEntry({ pagination: p, rowCount }) {
|
|
254
|
+
upstreamRows += rowCount;
|
|
255
|
+
if (rowCount === 0) {
|
|
256
|
+
return p.cursor > 0 ? { cursor: p.cursor, exhausted: true } : { ...p, total: 0 };
|
|
257
|
+
}
|
|
258
|
+
const next = p.cursor + rowCount;
|
|
259
|
+
return { ...p, ...(p.total !== undefined && next < p.total && { nextCursor: next }) };
|
|
260
|
+
}
|
|
261
|
+
for (const [i, result] of settled.entries()) {
|
|
262
|
+
const server = servers[i];
|
|
263
|
+
if (result.status === 'rejected') {
|
|
264
|
+
ctx.log.warning(`${SERVER_LABEL[server]} publication listing failed`, {
|
|
265
|
+
error: String(result.reason),
|
|
266
|
+
});
|
|
267
|
+
failed.push({ server, error: errorMessage(result.reason) });
|
|
268
|
+
rejections.push(result.reason);
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
pagination[server] = toPaginationEntry(result.value);
|
|
272
|
+
publications.push(...result.value.publications.map((p) => ({ ...p, server })));
|
|
273
|
+
}
|
|
274
|
+
// Nothing answered: an empty page here would be indistinguishable from an
|
|
275
|
+
// interval that holds no publications.
|
|
276
|
+
if (failed.length === servers.length) {
|
|
277
|
+
const message = servers.length > 1
|
|
278
|
+
? `Neither bioRxiv nor medRxiv answered — ${failed.map((f) => `${SERVER_LABEL[f.server]}: ${f.error}`).join('; ')}`
|
|
279
|
+
: `${SERVER_LABEL[failed[0]?.server]} did not answer — ${failed[0]?.error}`;
|
|
280
|
+
const failedServers = failed.map((f) => f.server);
|
|
281
|
+
// A rate limit outranks a generic outage: only it says when to retry.
|
|
282
|
+
const rateLimit = findRateLimit(rejections);
|
|
283
|
+
if (rateLimit) {
|
|
284
|
+
throw ctx.fail('rate_limited', message, {
|
|
285
|
+
servers: failedServers,
|
|
286
|
+
...(rateLimit.retryAfter !== undefined && { retryAfter: rateLimit.retryAfter }),
|
|
287
|
+
recovery: {
|
|
288
|
+
hint: `Wait ${describeWait(rateLimit.retryAfter)} before retrying — api.biorxiv.org is rate-limiting this host, and every preprint metadata tool queries the same origin.`,
|
|
289
|
+
},
|
|
290
|
+
}, { cause: rejections[0] });
|
|
291
|
+
}
|
|
292
|
+
throw ctx.fail('upstream_unavailable', message, { servers: failedServers }, { cause: rejections[0] });
|
|
293
|
+
}
|
|
294
|
+
// ctx.enrich.notice is last-wins, so every qualification is collected first.
|
|
295
|
+
const notices = [];
|
|
296
|
+
if (failed.length > 0) {
|
|
297
|
+
const labels = serverLabels(failed.map((f) => f.server));
|
|
298
|
+
notices.push(`${labels} did not answer, so this result set is partial — it holds no ${labels} publications. See failed[] for the error and retry to include them.`);
|
|
299
|
+
}
|
|
300
|
+
if (input.limit > UPSTREAM_PAGE_ROWS) {
|
|
301
|
+
notices.push(`A limit of ${input.limit} is above the ${UPSTREAM_PAGE_ROWS}-row page api.biorxiv.org serves, so this page holds up to ${UPSTREAM_PAGE_ROWS} rows per server.`);
|
|
302
|
+
}
|
|
303
|
+
const exhausted = SERVERS.filter((s) => pagination[s]?.exhausted);
|
|
304
|
+
if (upstreamRows === 0) {
|
|
305
|
+
notices.push(input.cursor > 0
|
|
306
|
+
? `Cursor ${input.cursor} is at or past the last row for this interval${failed.length > 0 ? ' on the servers that answered' : ''}. Set cursor to a lower offset.`
|
|
307
|
+
: `No journal publications found for publication dates ${input.start_date}–${input.end_date}${input.server === 'both' ? '' : ` on ${SERVER_LABEL[input.server]}`}. Try widening the date range, or use biorxiv_list_recent to list preprints by posting date instead.`);
|
|
308
|
+
}
|
|
309
|
+
else if (exhausted.length > 0) {
|
|
310
|
+
notices.push(`Cursor ${input.cursor} is at or past the last row on ${serverLabels(exhausted)} — that entry is marked exhausted and carries no total. Lower the cursor to page that server.`);
|
|
311
|
+
}
|
|
312
|
+
const continuing = SERVERS.filter((s) => pagination[s]?.nextCursor !== undefined);
|
|
313
|
+
if (continuing.length > 0) {
|
|
314
|
+
const where = continuing
|
|
315
|
+
.map((s) => `${SERVER_LABEL[s]} (next cursor ${pagination[s]?.nextCursor})`)
|
|
316
|
+
.join(' and ');
|
|
317
|
+
// Kept at "both", a server already on its last page is re-requested on every
|
|
318
|
+
// later page. A failed server is the exception: retrying "both" includes it.
|
|
319
|
+
const [only] = continuing;
|
|
320
|
+
const how = servers.length > 1 && failed.length === 0 && continuing.length === 1
|
|
321
|
+
? `pass that nextCursor as cursor with server set to "${only}" to continue it`
|
|
322
|
+
: "pass a server's nextCursor as cursor to continue it";
|
|
323
|
+
notices.push(`More rows remain past this page on ${where} — ${how}.`);
|
|
324
|
+
// truncated() writes the notice too, so it carries the composed string.
|
|
325
|
+
ctx.enrich.truncated({
|
|
326
|
+
shown: publications.length,
|
|
327
|
+
cap: limit * servers.length,
|
|
328
|
+
guidance: notices.join(' '),
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
else if (notices.length > 0) {
|
|
332
|
+
ctx.enrich.notice(notices.join(' '));
|
|
333
|
+
}
|
|
334
|
+
if (!input.include_abstract) {
|
|
335
|
+
publications = publications.map(({ preprintAbstract: _abstract, ...rest }) => rest);
|
|
336
|
+
}
|
|
337
|
+
return { publications, pagination, failed };
|
|
338
|
+
},
|
|
339
|
+
format: (result) => {
|
|
340
|
+
const lines = [];
|
|
341
|
+
for (const server of SERVERS) {
|
|
342
|
+
const p = result.pagination[server];
|
|
343
|
+
if (!p)
|
|
344
|
+
continue;
|
|
345
|
+
let line = `**${SERVER_LABEL[server]}:** page offset ${p.cursor}`;
|
|
346
|
+
if (p.total !== undefined)
|
|
347
|
+
line += `, total ${p.total}`;
|
|
348
|
+
if (p.nextCursor !== undefined)
|
|
349
|
+
line += ` — next cursor: ${p.nextCursor}`;
|
|
350
|
+
if (p.exhausted)
|
|
351
|
+
line +=
|
|
352
|
+
' — cursor exhausted: at or past the last row, so no rows and no total at this offset';
|
|
353
|
+
if (p.nextCursor === undefined && !p.exhausted)
|
|
354
|
+
line += ' (last page)';
|
|
355
|
+
lines.push(line);
|
|
356
|
+
}
|
|
357
|
+
// A failed server has no pagination line of its own; its silent absence is
|
|
358
|
+
// what would make a partial result look complete.
|
|
359
|
+
for (const f of result.failed) {
|
|
360
|
+
lines.push(`**${SERVER_LABEL[f.server]}:** server did not answer — no publications from it are included (${f.error})`);
|
|
361
|
+
}
|
|
362
|
+
if (result.publications.length > 0) {
|
|
363
|
+
lines.push(`\n## Journal publications (${result.publications.length} shown)`);
|
|
364
|
+
for (const p of result.publications) {
|
|
365
|
+
lines.push('');
|
|
366
|
+
lines.push(formatPublication(p));
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
370
|
+
},
|
|
371
|
+
});
|
|
372
|
+
//# sourceMappingURL=biorxiv-list-published-versions.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"biorxiv-list-published-versions.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-list-published-versions.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAM7E,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,OAAO,GAAG,CAAC,SAAS,EAAE,SAAS,CAAU,CAAC;AAChD,MAAM,YAAY,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SA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AE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -107,7 +107,7 @@ export declare const biorxivListRecentTool: import("@cyanheads/mcp-ts-core").Too
|
|
|
107
107
|
readonly code: JsonRpcErrorCode.RateLimited;
|
|
108
108
|
readonly retryable: true;
|
|
109
109
|
readonly when: "Every attempted server failed and at least one was rejected with HTTP 429 by api.biorxiv.org.";
|
|
110
|
-
readonly recovery: "Wait the retryAfter seconds before retrying — every preprint metadata tool queries the same origin, so none of them will answer sooner.";
|
|
110
|
+
readonly recovery: "Wait the retryAfter seconds when present, otherwise a minute or two, before retrying — every preprint metadata tool queries the same origin, so none of them will answer sooner.";
|
|
111
111
|
}], {
|
|
112
112
|
readonly notice: z.ZodOptional<z.ZodString>;
|
|
113
113
|
readonly categoryNote: z.ZodOptional<z.ZodString>;
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAmDjE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgjBhC,CAAC"}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
32
32
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
33
33
|
import { getBiorxivApiService } from '../../../services/biorxiv/biorxiv-service.js';
|
|
34
|
-
import { describeWait, escapeMarkdown, findRateLimit, isValidCalendarDate, normalizeRorId, } from '../../../services/shared.js';
|
|
34
|
+
import { describeWait, escapeMarkdown, findRateLimit, isValidCalendarDate, normalizeRorId, startCallDeadline, } from '../../../services/shared.js';
|
|
35
35
|
const DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
36
36
|
const SERVERS = ['biorxiv', 'medrxiv'];
|
|
37
37
|
const SERVER_LABEL = { biorxiv: 'bioRxiv', medrxiv: 'medRxiv' };
|
|
@@ -224,7 +224,7 @@ export const biorxivListRecentTool = tool('biorxiv_list_recent', {
|
|
|
224
224
|
code: JsonRpcErrorCode.RateLimited,
|
|
225
225
|
retryable: true,
|
|
226
226
|
when: 'Every attempted server failed and at least one was rejected with HTTP 429 by api.biorxiv.org.',
|
|
227
|
-
recovery: 'Wait the retryAfter seconds before retrying — every preprint metadata tool queries the same origin, so none of them will answer sooner.',
|
|
227
|
+
recovery: 'Wait the retryAfter seconds when present, otherwise a minute or two, before retrying — every preprint metadata tool queries the same origin, so none of them will answer sooner.',
|
|
228
228
|
},
|
|
229
229
|
],
|
|
230
230
|
async handler(input, ctx) {
|
|
@@ -273,11 +273,29 @@ export const biorxivListRecentTool = tool('biorxiv_list_recent', {
|
|
|
273
273
|
throw ctx.fail('invalid_category', `Category "${category}" is not valid for ${serverLabel}${scope}.`);
|
|
274
274
|
}
|
|
275
275
|
const filters = { category, funder };
|
|
276
|
+
const deadline = startCallDeadline();
|
|
276
277
|
const pagination = {};
|
|
277
278
|
const failed = [];
|
|
278
279
|
// Raw rejection values alongside failed[], so the all-failed branch can tell
|
|
279
280
|
// a rate limit from a generic outage and preserve the original as `cause`.
|
|
280
281
|
const rejections = [];
|
|
282
|
+
// No server returned a usable page. A rate limit outranks a generic outage:
|
|
283
|
+
// both say "retry", but only one says when, and retrying sooner would land
|
|
284
|
+
// inside the same limit.
|
|
285
|
+
const unanswered = (message, servers) => {
|
|
286
|
+
const rateLimit = findRateLimit(rejections);
|
|
287
|
+
if (rateLimit) {
|
|
288
|
+
const wait = describeWait(rateLimit.retryAfter);
|
|
289
|
+
return ctx.fail('rate_limited', message, {
|
|
290
|
+
servers,
|
|
291
|
+
...(rateLimit.retryAfter !== undefined && { retryAfter: rateLimit.retryAfter }),
|
|
292
|
+
recovery: {
|
|
293
|
+
hint: `Wait ${wait} before retrying — api.biorxiv.org is rate-limiting this host, and every preprint metadata tool queries the same origin.`,
|
|
294
|
+
},
|
|
295
|
+
}, { cause: rejections[0] });
|
|
296
|
+
}
|
|
297
|
+
return ctx.fail('upstream_unavailable', message, { servers }, { cause: rejections[0] });
|
|
298
|
+
};
|
|
281
299
|
// ctx.enrich.notice is last-wins, so every qualification that applies to this
|
|
282
300
|
// result set is collected here and flushed as one string before returning.
|
|
283
301
|
const notices = [];
|
|
@@ -330,7 +348,16 @@ export const biorxivListRecentTool = tool('biorxiv_list_recent', {
|
|
|
330
348
|
// funder filter or onto the server owning a server-exclusive category.
|
|
331
349
|
const singleServer = exclusiveServer ?? (target === 'both' ? undefined : target);
|
|
332
350
|
if (singleServer) {
|
|
333
|
-
const r = await service
|
|
351
|
+
const r = await service
|
|
352
|
+
.getListing(singleServer, input.start_date, input.end_date, input.cursor, filters, deadline, ctx)
|
|
353
|
+
.catch((err) => {
|
|
354
|
+
// A listing the caller's cancellation stopped is that cancellation.
|
|
355
|
+
ctx.signal.throwIfAborted();
|
|
356
|
+
rejections.push(err);
|
|
357
|
+
throw unanswered(`${SERVER_LABEL[singleServer]} did not answer — ${errorMessage(err)}`, [
|
|
358
|
+
singleServer,
|
|
359
|
+
]);
|
|
360
|
+
});
|
|
334
361
|
// No funder record means no filter was applied at all — the empty page
|
|
335
362
|
// says nothing about what the funder posted.
|
|
336
363
|
if (r.funderNotFound) {
|
|
@@ -350,7 +377,9 @@ export const biorxivListRecentTool = tool('biorxiv_list_recent', {
|
|
|
350
377
|
// Fan out to both servers. Any category here is shared by both taxonomies,
|
|
351
378
|
// so it applies to each; with no category both return unfiltered pages.
|
|
352
379
|
// A funder filter never reaches this branch — it narrows the call to bioRxiv.
|
|
353
|
-
const settled = await Promise.allSettled(SERVERS.map((server) => service.getListing(server, input.start_date, input.end_date, input.cursor, filters, ctx)));
|
|
380
|
+
const settled = await Promise.allSettled(SERVERS.map((server) => service.getListing(server, input.start_date, input.end_date, input.cursor, filters, deadline, ctx)));
|
|
381
|
+
// A cancelled call is not a partial result, whichever leg the abort reached first.
|
|
382
|
+
ctx.signal.throwIfAborted();
|
|
354
383
|
// Servers that answered but ignored the category filter — their pages are
|
|
355
384
|
// unfiltered, so they are left out rather than mixed in with filtered ones.
|
|
356
385
|
const ignored = [];
|
|
@@ -387,24 +416,9 @@ export const biorxivListRecentTool = tool('biorxiv_list_recent', {
|
|
|
387
416
|
...failed.map((f) => `${SERVER_LABEL[f.server]}: ${f.error}`),
|
|
388
417
|
...ignored.map((s) => `${SERVER_LABEL[s]} ignored the category filter "${category}"`),
|
|
389
418
|
].join('; ');
|
|
390
|
-
|
|
419
|
+
throw unanswered(ignored.length === 0
|
|
391
420
|
? `Neither bioRxiv nor medRxiv answered — ${detail}`
|
|
392
|
-
: `No server returned a usable page — ${detail}
|
|
393
|
-
const servers = failed.map((f) => f.server);
|
|
394
|
-
// A rate limit outranks a generic outage: both say "retry", but only one
|
|
395
|
-
// says when, and retrying sooner would land inside the same limit.
|
|
396
|
-
const rateLimit = findRateLimit(rejections);
|
|
397
|
-
if (rateLimit) {
|
|
398
|
-
const wait = describeWait(rateLimit.retryAfter);
|
|
399
|
-
throw ctx.fail('rate_limited', message, {
|
|
400
|
-
servers,
|
|
401
|
-
...(rateLimit.retryAfter !== undefined && { retryAfter: rateLimit.retryAfter }),
|
|
402
|
-
recovery: {
|
|
403
|
-
hint: `Wait ${wait} before retrying — api.biorxiv.org is rate-limiting this host, and every preprint metadata tool queries the same origin.`,
|
|
404
|
-
},
|
|
405
|
-
}, { cause: rejections[0] });
|
|
406
|
-
}
|
|
407
|
-
throw ctx.fail('upstream_unavailable', message, { servers }, { cause: rejections[0] });
|
|
421
|
+
: `No server returned a usable page — ${detail}`, failed.map((f) => f.server));
|
|
408
422
|
}
|
|
409
423
|
// A server that never answered contributes no pagination entry, so nothing
|
|
410
424
|
// else in the response distinguishes "that server had no preprints" from
|