@cyanheads/zenodo-mcp-server 0.1.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.
Files changed (97) hide show
  1. package/AGENTS.md +435 -0
  2. package/CLAUDE.md +435 -0
  3. package/Dockerfile +140 -0
  4. package/LICENSE +201 -0
  5. package/README.md +292 -0
  6. package/changelog/0.1.x/0.1.1.md +21 -0
  7. package/changelog/template.md +151 -0
  8. package/dist/config/server-config.d.ts +13 -0
  9. package/dist/config/server-config.d.ts.map +1 -0
  10. package/dist/config/server-config.js +19 -0
  11. package/dist/config/server-config.js.map +1 -0
  12. package/dist/index.d.ts +7 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +21 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/mcp-server/tools/definitions/get-record.tool.d.ts +186 -0
  17. package/dist/mcp-server/tools/definitions/get-record.tool.d.ts.map +1 -0
  18. package/dist/mcp-server/tools/definitions/get-record.tool.js +568 -0
  19. package/dist/mcp-server/tools/definitions/get-record.tool.js.map +1 -0
  20. package/dist/mcp-server/tools/definitions/index.d.ts +721 -0
  21. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
  22. package/dist/mcp-server/tools/definitions/index.js +21 -0
  23. package/dist/mcp-server/tools/definitions/index.js.map +1 -0
  24. package/dist/mcp-server/tools/definitions/list-files.tool.d.ts +108 -0
  25. package/dist/mcp-server/tools/definitions/list-files.tool.d.ts.map +1 -0
  26. package/dist/mcp-server/tools/definitions/list-files.tool.js +348 -0
  27. package/dist/mcp-server/tools/definitions/list-files.tool.js.map +1 -0
  28. package/dist/mcp-server/tools/definitions/list-versions.tool.d.ts +92 -0
  29. package/dist/mcp-server/tools/definitions/list-versions.tool.d.ts.map +1 -0
  30. package/dist/mcp-server/tools/definitions/list-versions.tool.js +268 -0
  31. package/dist/mcp-server/tools/definitions/list-versions.tool.js.map +1 -0
  32. package/dist/mcp-server/tools/definitions/lookup-vocabulary.tool.d.ts +99 -0
  33. package/dist/mcp-server/tools/definitions/lookup-vocabulary.tool.d.ts.map +1 -0
  34. package/dist/mcp-server/tools/definitions/lookup-vocabulary.tool.js +324 -0
  35. package/dist/mcp-server/tools/definitions/lookup-vocabulary.tool.js.map +1 -0
  36. package/dist/mcp-server/tools/definitions/read-file.tool.d.ts +104 -0
  37. package/dist/mcp-server/tools/definitions/read-file.tool.d.ts.map +1 -0
  38. package/dist/mcp-server/tools/definitions/read-file.tool.js +370 -0
  39. package/dist/mcp-server/tools/definitions/read-file.tool.js.map +1 -0
  40. package/dist/mcp-server/tools/definitions/search-records.tool.d.ts +181 -0
  41. package/dist/mcp-server/tools/definitions/search-records.tool.d.ts.map +1 -0
  42. package/dist/mcp-server/tools/definitions/search-records.tool.js +531 -0
  43. package/dist/mcp-server/tools/definitions/search-records.tool.js.map +1 -0
  44. package/dist/mcp-server/tools/record-miss.d.ts +37 -0
  45. package/dist/mcp-server/tools/record-miss.d.ts.map +1 -0
  46. package/dist/mcp-server/tools/record-miss.js +51 -0
  47. package/dist/mcp-server/tools/record-miss.js.map +1 -0
  48. package/dist/mcp-server/tools/render.d.ts +31 -0
  49. package/dist/mcp-server/tools/render.d.ts.map +1 -0
  50. package/dist/mcp-server/tools/render.js +53 -0
  51. package/dist/mcp-server/tools/render.js.map +1 -0
  52. package/dist/mcp-server/tools/schema-helpers.d.ts +20 -0
  53. package/dist/mcp-server/tools/schema-helpers.d.ts.map +1 -0
  54. package/dist/mcp-server/tools/schema-helpers.js +44 -0
  55. package/dist/mcp-server/tools/schema-helpers.js.map +1 -0
  56. package/dist/services/zenodo/cache.d.ts +25 -0
  57. package/dist/services/zenodo/cache.d.ts.map +1 -0
  58. package/dist/services/zenodo/cache.js +58 -0
  59. package/dist/services/zenodo/cache.js.map +1 -0
  60. package/dist/services/zenodo/html-to-text.d.ts +23 -0
  61. package/dist/services/zenodo/html-to-text.d.ts.map +1 -0
  62. package/dist/services/zenodo/html-to-text.js +148 -0
  63. package/dist/services/zenodo/html-to-text.js.map +1 -0
  64. package/dist/services/zenodo/http.d.ts +73 -0
  65. package/dist/services/zenodo/http.d.ts.map +1 -0
  66. package/dist/services/zenodo/http.js +378 -0
  67. package/dist/services/zenodo/http.js.map +1 -0
  68. package/dist/services/zenodo/identifiers.d.ts +104 -0
  69. package/dist/services/zenodo/identifiers.d.ts.map +1 -0
  70. package/dist/services/zenodo/identifiers.js +261 -0
  71. package/dist/services/zenodo/identifiers.js.map +1 -0
  72. package/dist/services/zenodo/normalize.d.ts +29 -0
  73. package/dist/services/zenodo/normalize.d.ts.map +1 -0
  74. package/dist/services/zenodo/normalize.js +324 -0
  75. package/dist/services/zenodo/normalize.js.map +1 -0
  76. package/dist/services/zenodo/query-builder.d.ts +87 -0
  77. package/dist/services/zenodo/query-builder.d.ts.map +1 -0
  78. package/dist/services/zenodo/query-builder.js +221 -0
  79. package/dist/services/zenodo/query-builder.js.map +1 -0
  80. package/dist/services/zenodo/resource-types.d.ts +34 -0
  81. package/dist/services/zenodo/resource-types.d.ts.map +1 -0
  82. package/dist/services/zenodo/resource-types.js +97 -0
  83. package/dist/services/zenodo/resource-types.js.map +1 -0
  84. package/dist/services/zenodo/text-preview.d.ts +56 -0
  85. package/dist/services/zenodo/text-preview.d.ts.map +1 -0
  86. package/dist/services/zenodo/text-preview.js +151 -0
  87. package/dist/services/zenodo/text-preview.js.map +1 -0
  88. package/dist/services/zenodo/types.d.ts +517 -0
  89. package/dist/services/zenodo/types.d.ts.map +1 -0
  90. package/dist/services/zenodo/types.js +8 -0
  91. package/dist/services/zenodo/types.js.map +1 -0
  92. package/dist/services/zenodo/zenodo-service.d.ts +98 -0
  93. package/dist/services/zenodo/zenodo-service.d.ts.map +1 -0
  94. package/dist/services/zenodo/zenodo-service.js +392 -0
  95. package/dist/services/zenodo/zenodo-service.js.map +1 -0
  96. package/package.json +110 -0
  97. package/server.json +113 -0
@@ -0,0 +1,324 @@
1
+ /**
2
+ * @fileoverview zenodo_lookup_vocabulary — resolves community, funder, award,
3
+ * license, and resource-type names to the ids zenodo_search_records filters on.
4
+ * The routing target for every unknown-value and zero-hit path.
5
+ * @module mcp-server/tools/definitions/lookup-vocabulary
6
+ */
7
+ import { tool, z } from '@cyanheads/mcp-ts-core';
8
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
9
+ import { parseFunderRef } from '../../../services/zenodo/identifiers.js';
10
+ import { filterResourceTypes } from '../../../services/zenodo/resource-types.js';
11
+ import { getZenodoService } from '../../../services/zenodo/zenodo-service.js';
12
+ import { hasLineBreak, inline, quoteBlock } from '../render.js';
13
+ import { blankToUndefined, enumPreprocess } from '../schema-helpers.js';
14
+ const VOCABULARIES = ['communities', 'funders', 'awards', 'licenses', 'resource_types'];
15
+ const RESULT_WINDOW = 10_000;
16
+ /** What to try after a query matched nothing, per vocabulary. */
17
+ const ZERO_HIT_ADVICE = {
18
+ communities: "try a shorter name, a keyword from the community's title, or the project's acronym",
19
+ funders: "try a shorter name or the funder's acronym",
20
+ awards: "try the grant number, the project's acronym, or a shorter keyword from the award title",
21
+ licenses: 'try a shorter keyword such as cc-by, gpl, or mit, or call again without query to browse all licenses',
22
+ resource_types: 'every word must appear in a type id or label, so try a shorter keyword, or call again without query to list all 43 types',
23
+ };
24
+ const EntrySchema = z
25
+ .object({
26
+ filter_param: z
27
+ .enum(['community', 'funder', 'award', 'license', 'resource_type'])
28
+ .describe('The zenodo_search_records parameter this entry’s filter_value feeds.'),
29
+ filter_value: z
30
+ .string()
31
+ .describe('The id to pass to zenodo_search_records as filter_param (community slug, funder ROR id, award id, license id, or resource type id).'),
32
+ label: z
33
+ .string()
34
+ .describe('Display name: community title, funder name, award acronym (else title or number), license title, or resource type label.'),
35
+ slug: z.string().optional().describe('Community slug (communities).'),
36
+ uuid: z.string().optional().describe('Community UUID (communities).'),
37
+ community_type: z
38
+ .string()
39
+ .optional()
40
+ .describe('Community type, e.g. Organization or Project (communities).'),
41
+ website: z.string().optional().describe('Community website (communities).'),
42
+ organizations: z
43
+ .array(z.string())
44
+ .optional()
45
+ .describe('Organizations behind the community, by name or ROR id (communities).'),
46
+ ror_id: z.string().optional().describe('Funder ROR id (funders).'),
47
+ funder_doi: z
48
+ .string()
49
+ .optional()
50
+ .describe('Crossref Funder Registry DOI, 10.13039/… (funders).'),
51
+ acronym: z.string().optional().describe('Funder or award acronym (funders, awards).'),
52
+ country: z.string().optional().describe('Funder country code, ISO 3166-1 alpha-2 (funders).'),
53
+ country_name: z.string().optional().describe('Funder country name (funders).'),
54
+ number: z.string().optional().describe('Grant number (awards).'),
55
+ title: z.string().optional().describe('Full award title (awards).'),
56
+ program: z.string().optional().describe('Funding program, e.g. HORIZON.2.6 (awards).'),
57
+ funder_id: z.string().optional().describe('ROR id of the awarding funder (awards).'),
58
+ funder_name: z.string().optional().describe('Name of the awarding funder (awards).'),
59
+ award_doi: z.string().optional().describe('Award DOI, e.g. a CORDIS 10.3030/… DOI (awards).'),
60
+ award_url: z.string().optional().describe('Award landing page URL (awards).'),
61
+ start_date: z.string().optional().describe('Award start date (awards).'),
62
+ end_date: z.string().optional().describe('Award end date (awards).'),
63
+ url: z.string().optional().describe('License text URL (licenses).'),
64
+ osi_approved: z
65
+ .boolean()
66
+ .optional()
67
+ .describe('Whether the license is OSI-approved; omitted when upstream does not say (licenses).'),
68
+ tags: z
69
+ .array(z.string())
70
+ .optional()
71
+ .describe('License tags, e.g. recommended, software, data (licenses).'),
72
+ parent_type: z
73
+ .string()
74
+ .optional()
75
+ .describe('Parent type id of a resource subtype (resource_types).'),
76
+ search_value: z
77
+ .string()
78
+ .optional()
79
+ .describe('Zenodo’s own spelling of this type (<type>::<id> for a subtype); zenodo_search_records accepts it or filter_value as resource_type (resource_types).'),
80
+ })
81
+ .describe('One vocabulary entry. Fields beyond filter_param, filter_value, and label are present only for the vocabulary they belong to, and only when Zenodo supplies them.');
82
+ /** Maps a remote vocabulary page to the flat entry shape. */
83
+ function toEntries(page) {
84
+ switch (page.vocabulary) {
85
+ case 'communities':
86
+ return page.entries.map((c) => ({
87
+ filter_param: 'community',
88
+ filter_value: c.slug,
89
+ label: c.title ?? c.slug,
90
+ slug: c.slug,
91
+ uuid: c.uuid,
92
+ ...(c.community_type ? { community_type: c.community_type } : {}),
93
+ ...(c.website ? { website: c.website } : {}),
94
+ ...(c.organizations.length ? { organizations: c.organizations } : {}),
95
+ }));
96
+ case 'funders':
97
+ return page.entries.map((f) => ({
98
+ filter_param: 'funder',
99
+ filter_value: f.ror_id,
100
+ label: f.name ?? f.ror_id,
101
+ ror_id: f.ror_id,
102
+ ...(f.funder_doi ? { funder_doi: f.funder_doi } : {}),
103
+ ...(f.acronym ? { acronym: f.acronym } : {}),
104
+ ...(f.country ? { country: f.country } : {}),
105
+ ...(f.country_name ? { country_name: f.country_name } : {}),
106
+ }));
107
+ case 'awards':
108
+ return page.entries.map((a) => ({
109
+ filter_param: 'award',
110
+ filter_value: a.id,
111
+ label: a.acronym ?? a.title ?? a.number ?? a.id,
112
+ ...(a.number ? { number: a.number } : {}),
113
+ ...(a.acronym ? { acronym: a.acronym } : {}),
114
+ ...(a.title ? { title: a.title } : {}),
115
+ ...(a.program ? { program: a.program } : {}),
116
+ ...(a.funder_id ? { funder_id: a.funder_id } : {}),
117
+ ...(a.funder_name ? { funder_name: a.funder_name } : {}),
118
+ ...(a.award_doi ? { award_doi: a.award_doi } : {}),
119
+ ...(a.award_url ? { award_url: a.award_url } : {}),
120
+ ...(a.start_date ? { start_date: a.start_date } : {}),
121
+ ...(a.end_date ? { end_date: a.end_date } : {}),
122
+ }));
123
+ case 'licenses':
124
+ return page.entries.map((l) => ({
125
+ filter_param: 'license',
126
+ filter_value: l.id,
127
+ label: l.title ?? l.id,
128
+ ...(l.url ? { url: l.url } : {}),
129
+ ...(l.osi_approved !== undefined ? { osi_approved: l.osi_approved } : {}),
130
+ ...(l.tags.length ? { tags: l.tags } : {}),
131
+ }));
132
+ }
133
+ }
134
+ export const lookupVocabulary = tool('zenodo_lookup_vocabulary', {
135
+ title: 'Look up Zenodo filter ids',
136
+ description: "Resolve names to the ids zenodo_search_records filters on, and browse Zenodo's reference vocabularies: communities (slug), funders (ROR id), awards and grants (award id), licenses (license id), and resource types (type id). Search by name, acronym, or keyword; awards can be scoped to one funder. Each entry names the zenodo_search_records parameter its id feeds.",
137
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
138
+ input: z.object({
139
+ vocabulary: z
140
+ .preprocess(enumPreprocess(VOCABULARIES, {
141
+ community: 'communities',
142
+ funder: 'funders',
143
+ award: 'awards',
144
+ grant: 'awards',
145
+ grants: 'awards',
146
+ license: 'licenses',
147
+ resource_type: 'resource_types',
148
+ }), z.enum(VOCABULARIES))
149
+ .describe('Which vocabulary to search: communities, funders, awards (grants), licenses, or resource_types. Case, spaces, hyphens, and underscores are ignored when matching, and the singular (funder, license, resource type) and grants are accepted.'),
150
+ query: z
151
+ .preprocess(blankToUndefined, z.string().max(200).optional())
152
+ .describe('Name, acronym, or keyword, e.g. "SYMBA", "wellcome", "mit", "journal article". For resource_types every word must appear in the type id or label. Omit to browse the vocabulary.'),
153
+ funder: z
154
+ .preprocess(blankToUndefined, z.string().max(200).optional())
155
+ .describe('awards only: scope grants to one funder, given as a ROR id (00k4n6c32), a ROR URL, or a Crossref Funder DOI (10.13039/100000002). Resolve a funder name to its ROR id with vocabulary funders first.'),
156
+ page: z.number().int().min(1).default(1).describe('Result page, starting at 1.'),
157
+ size: z.number().int().min(1).max(25).default(10).describe('Entries per page (1–25).'),
158
+ }),
159
+ output: z.object({
160
+ vocabulary: z.enum(VOCABULARIES).describe('The vocabulary searched.'),
161
+ query: z.string().optional().describe('The query as applied; absent when browsing.'),
162
+ total: z.number().describe('Total entries matching the query.'),
163
+ page: z.number().describe('Page returned.'),
164
+ size: z.number().describe('Page size applied.'),
165
+ has_more: z.boolean().describe('True when more pages follow this one.'),
166
+ next_page: z.number().optional().describe('The next page number, when has_more.'),
167
+ entries: z.array(EntrySchema).describe('Matching entries for this page.'),
168
+ }),
169
+ enrichment: {
170
+ truncated: z.boolean().describe('True when more entries exist beyond this page.'),
171
+ shown: z.number().describe('Entries returned on this page.'),
172
+ cap: z.number().describe('Page size applied.'),
173
+ totalCount: z.number().describe('Total entries matching the query.'),
174
+ notice: z
175
+ .string()
176
+ .optional()
177
+ .describe('Guidance on empty results, ambiguous funders, or further pages.'),
178
+ },
179
+ errors: [
180
+ {
181
+ reason: 'funder_only_for_awards',
182
+ code: JsonRpcErrorCode.ValidationError,
183
+ when: 'funder is set with a vocabulary other than awards',
184
+ recovery: 'Call zenodo_lookup_vocabulary again without funder, or set vocabulary to awards to scope grants by funder.',
185
+ },
186
+ {
187
+ reason: 'unknown_funder',
188
+ code: JsonRpcErrorCode.ValidationError,
189
+ when: 'funder (awards) resolves to no Zenodo funder',
190
+ recovery: 'Resolve the funder first with zenodo_lookup_vocabulary (vocabulary: funders) and pass its ROR id as funder.',
191
+ },
192
+ {
193
+ reason: 'result_window_exceeded',
194
+ code: JsonRpcErrorCode.ValidationError,
195
+ when: 'page × size exceeds 10,000',
196
+ recovery: 'Narrow the query and call zenodo_lookup_vocabulary again instead of paging past 10,000 entries.',
197
+ },
198
+ {
199
+ reason: 'rate_limited',
200
+ code: JsonRpcErrorCode.RateLimited,
201
+ when: "Zenodo answered HTTP 429, or this server's shared Zenodo request budget is spent for the current window",
202
+ retryable: true,
203
+ thrownBy: 'service',
204
+ recovery: 'Wait for the retryAfter seconds in the error data, then call zenodo_lookup_vocabulary again with the same arguments.',
205
+ },
206
+ ],
207
+ async handler(input, ctx) {
208
+ ctx.enrich({ truncated: false, shown: 0, cap: input.size, totalCount: 0 });
209
+ if (input.funder && input.vocabulary !== 'awards') {
210
+ throw ctx.fail('funder_only_for_awards', `funder applies only to vocabulary awards, not ${input.vocabulary}.`, ctx.recoveryFor('funder_only_for_awards'));
211
+ }
212
+ if (input.page * input.size > RESULT_WINDOW) {
213
+ throw ctx.fail('result_window_exceeded', `page ${input.page} × size ${input.size} is past the first ${RESULT_WINDOW.toLocaleString('en-US')} entries.`, ctx.recoveryFor('result_window_exceeded'));
214
+ }
215
+ let total;
216
+ let entries;
217
+ if (input.vocabulary === 'resource_types') {
218
+ const matched = filterResourceTypes(input.query);
219
+ total = matched.length;
220
+ entries = matched.slice((input.page - 1) * input.size, input.page * input.size).map((t) => ({
221
+ filter_param: 'resource_type',
222
+ filter_value: t.id,
223
+ label: t.label,
224
+ ...(t.parentType ? { parent_type: t.parentType } : {}),
225
+ search_value: t.searchValue,
226
+ }));
227
+ }
228
+ else {
229
+ const service = getZenodoService();
230
+ let funderRor;
231
+ if (input.funder) {
232
+ const ref = parseFunderRef(input.funder);
233
+ const funder = ref ? await service.resolveFunder(ref, ctx) : undefined;
234
+ if (!funder) {
235
+ throw ctx.fail('unknown_funder', `"${inline(input.funder)}" is not a known ROR id and no funder carries that Crossref Funder DOI.`, ctx.recoveryFor('unknown_funder'));
236
+ }
237
+ funderRor = funder.ror_id;
238
+ }
239
+ const page = await service.searchVocabulary(input.vocabulary, { query: input.query, funderRor, page: input.page, size: input.size }, ctx);
240
+ total = page.total;
241
+ entries = toEntries(page);
242
+ }
243
+ const reachable = Math.min(total, RESULT_WINDOW);
244
+ const hasMore = input.page * input.size < reachable;
245
+ ctx.enrich({ shown: entries.length });
246
+ ctx.enrich.total(total);
247
+ const notice = [];
248
+ if (total === 0) {
249
+ notice.push(input.query
250
+ ? `No ${input.vocabulary} matched "${inline(input.query)}"; ${ZERO_HIT_ADVICE[input.vocabulary]}${input.funder ? ', or drop funder to search every funder’s grants' : ''}.`
251
+ : `No ${input.vocabulary} entries were returned.`);
252
+ }
253
+ else if (entries.length === 0) {
254
+ const last = Math.max(1, Math.ceil(reachable / input.size));
255
+ notice.push(`Page ${input.page} is past the last page (${last}); call again with page ${last} or lower.`);
256
+ }
257
+ if (input.vocabulary === 'funders' && entries.length > 1) {
258
+ notice.push('Several funders share names across countries; pick by country and ROR id.');
259
+ }
260
+ if (hasMore) {
261
+ notice.push(`Showing ${entries.length} of ${total}; call again with page ${input.page + 1}.`);
262
+ ctx.enrich.truncated({ shown: entries.length, cap: input.size, guidance: notice.join(' ') });
263
+ }
264
+ else if (notice.length) {
265
+ ctx.enrich.notice(notice.join(' '));
266
+ }
267
+ return {
268
+ vocabulary: input.vocabulary,
269
+ ...(input.query ? { query: input.query } : {}),
270
+ total,
271
+ page: input.page,
272
+ size: input.size,
273
+ has_more: hasMore,
274
+ ...(hasMore ? { next_page: input.page + 1 } : {}),
275
+ entries,
276
+ };
277
+ },
278
+ format: (result) => {
279
+ const lines = [
280
+ `## Zenodo ${result.vocabulary}${result.query ? ` matching "${inline(result.query)}"` : ''}`,
281
+ `**Total:** ${result.total} | **Page:** ${result.page} | **Size:** ${result.size} | **Has more:** ${result.has_more}${result.next_page !== undefined ? ` | **Next page:** ${result.next_page}` : ''}`,
282
+ ];
283
+ for (const e of result.entries) {
284
+ lines.push('', `### ${inline(e.label)}`, `- **Filter:** ${e.filter_param} = \`${inline(e.filter_value)}\``);
285
+ const field = (label, value) => {
286
+ if (value)
287
+ lines.push(`- **${label}:** ${inline(value)}`);
288
+ };
289
+ field('Slug', e.slug);
290
+ field('UUID', e.uuid);
291
+ field('Community type', e.community_type);
292
+ field('Website', e.website);
293
+ if (e.organizations?.length)
294
+ lines.push(`- **Organizations:** ${e.organizations.map(inline).join('; ')}`);
295
+ field('ROR id', e.ror_id);
296
+ field('Funder DOI', e.funder_doi);
297
+ field('Acronym', e.acronym);
298
+ field('Country', e.country);
299
+ field('Country name', e.country_name);
300
+ field('Number', e.number);
301
+ if (e.title) {
302
+ lines.push(hasLineBreak(e.title)
303
+ ? `- **Title:**\n${quoteBlock(e.title, 'Award title (untrusted):')}`
304
+ : `- **Title:** ${e.title}`);
305
+ }
306
+ field('Program', e.program);
307
+ field('Funder id', e.funder_id);
308
+ field('Funder name', e.funder_name);
309
+ field('Award DOI', e.award_doi);
310
+ field('Award URL', e.award_url);
311
+ field('Start date', e.start_date);
312
+ field('End date', e.end_date);
313
+ field('URL', e.url);
314
+ if (e.osi_approved !== undefined)
315
+ lines.push(`- **OSI approved:** ${e.osi_approved}`);
316
+ if (e.tags?.length)
317
+ lines.push(`- **Tags:** ${e.tags.map(inline).join(', ')}`);
318
+ field('Parent type', e.parent_type);
319
+ field('Search value', e.search_value);
320
+ }
321
+ return [{ type: 'text', text: lines.join('\n') }];
322
+ },
323
+ });
324
+ //# sourceMappingURL=lookup-vocabulary.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lookup-vocabulary.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/lookup-vocabulary.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAExE,MAAM,YAAY,GAAG,CAAC,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,CAAU,CAAC;AAEjG,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,iEAAiE;AACjE,MAAM,eAAe,GAA+B;IAClD,WAAW,EAAE,oFAAoF;IACjG,OAAO,EAAE,4CAA4C;IACrD,MAAM,EAAE,wFAAwF;IAChG,QAAQ,EACN,sGAAsG;IACxG,cAAc,EACZ,0HAA0H;CAC7H,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC;IACN,YAAY,EAAE,CAAC;SACZ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AAC,CAAC;YAC5B,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;YAChC,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC;YACpC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;YAChC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;YAChC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;YAClC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;YAC9B,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;YACpB,IAAI,CAAC,CAAC,YAAY,KAAK,SAAS;gBAAE,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC;YACtF,IAAI,CAAC,CAAC,IAAI,EAAE,MAAM;gBAAE,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC/E,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC;YACpC,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * @fileoverview zenodo_read_file — reads a byte-capped UTF-8 excerpt of one text
3
+ * file in a Zenodo deposit, or of one member of a .zip file, without downloading
4
+ * the archive. Content is depositor-supplied, rendered fenced as untrusted data,
5
+ * and carries the deposit's license.
6
+ * @module mcp-server/tools/definitions/read-file
7
+ */
8
+ import { z } from '@cyanheads/mcp-ts-core';
9
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
10
+ export declare const readFile: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
11
+ id: z.ZodString;
12
+ key: z.ZodString;
13
+ archive_member: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
14
+ offset_bytes: z.ZodDefault<z.ZodNumber>;
15
+ max_bytes: z.ZodDefault<z.ZodNumber>;
16
+ }, z.core.$strip>, z.ZodObject<{
17
+ recid: z.ZodString;
18
+ key: z.ZodString;
19
+ archive_member: z.ZodOptional<z.ZodString>;
20
+ status: z.ZodEnum<{
21
+ empty: "empty";
22
+ not_text: "not_text";
23
+ restricted: "restricted";
24
+ text: "text";
25
+ }>;
26
+ mimetype: z.ZodOptional<z.ZodString>;
27
+ file_size: z.ZodOptional<z.ZodNumber>;
28
+ md5: z.ZodOptional<z.ZodString>;
29
+ text: z.ZodOptional<z.ZodString>;
30
+ offset_bytes: z.ZodNumber;
31
+ bytes_returned: z.ZodNumber;
32
+ next_offset: z.ZodOptional<z.ZodNumber>;
33
+ has_more: z.ZodBoolean;
34
+ replacement_chars: z.ZodNumber;
35
+ rights: z.ZodArray<z.ZodObject<{
36
+ id: z.ZodOptional<z.ZodString>;
37
+ title: z.ZodString;
38
+ }, z.core.$strip>>;
39
+ record_url: z.ZodString;
40
+ download_url: z.ZodString;
41
+ files_access: z.ZodOptional<z.ZodString>;
42
+ }, z.core.$strip>, readonly [{
43
+ readonly reason: "invalid_identifier";
44
+ readonly code: JsonRpcErrorCode.ValidationError;
45
+ readonly when: "id matches no accepted form, or is a GitHub-badge latestdoi id or a non-zenodo.org host";
46
+ readonly recovery: "Pass a Zenodo record id (22705923), a DOI (10.5281/zenodo.22705923), or a zenodo.org/records URL as id; for a title or keyword, use zenodo_search_records.";
47
+ }, {
48
+ readonly reason: "record_not_found";
49
+ readonly code: JsonRpcErrorCode.NotFound;
50
+ readonly when: "The record 404s, its metadata is restricted, or a non-Zenodo DOI is not registered to a record";
51
+ readonly recovery: "Check the id with zenodo_get_record, or find the deposit with zenodo_search_records.";
52
+ }, {
53
+ readonly reason: "record_deleted";
54
+ readonly code: JsonRpcErrorCode.NotFound;
55
+ readonly when: "The record was deleted from Zenodo; only its removal tombstone remains";
56
+ readonly recovery: "Call zenodo_get_record with this id for the removal date and reason, then find a replacement deposit with zenodo_search_records.";
57
+ }, {
58
+ readonly reason: "file_not_found";
59
+ readonly code: JsonRpcErrorCode.NotFound;
60
+ readonly when: "key is not in the record's manifest, or Zenodo serves no content for it";
61
+ readonly recovery: "Call zenodo_list_files with this id to see the record’s exact file keys.";
62
+ }, {
63
+ readonly reason: "not_an_archive";
64
+ readonly code: JsonRpcErrorCode.ValidationError;
65
+ readonly when: "archive_member is set but key is not a .zip";
66
+ readonly recovery: "Drop archive_member to read the file itself, or pick a .zip key from zenodo_list_files.";
67
+ }, {
68
+ readonly reason: "member_not_found";
69
+ readonly code: JsonRpcErrorCode.NotFound;
70
+ readonly when: "Zenodo has no member at archive_member inside the .zip";
71
+ readonly recovery: "Call zenodo_list_files with archive_key set to this key to see the member paths.";
72
+ }, {
73
+ readonly reason: "member_offset_unsupported";
74
+ readonly code: JsonRpcErrorCode.ValidationError;
75
+ readonly when: "offset_bytes is above 0 together with archive_member";
76
+ readonly recovery: "Read the member from offset_bytes 0 with a larger max_bytes (up to 65536), or download the archive from download_url.";
77
+ }, {
78
+ readonly reason: "offset_out_of_range";
79
+ readonly code: JsonRpcErrorCode.ValidationError;
80
+ readonly when: "offset_bytes is at or past the end of the file";
81
+ readonly recovery: "Call zenodo_read_file again with an offset_bytes below the file’s size (size in zenodo_list_files, file_size in a prior zenodo_read_file result).";
82
+ }, {
83
+ readonly reason: "archive_unavailable";
84
+ readonly code: JsonRpcErrorCode.ServiceUnavailable;
85
+ readonly when: "Zenodo cannot open the .zip named by key: its member listing or the member read answered HTTP 500 after one retry, or no complete response arrived in time";
86
+ readonly thrownBy: "service";
87
+ readonly recovery: "Zenodo cannot open every .zip; download the archive from the URL in the error message and extract the member locally, or read the record’s top-level files with zenodo_read_file.";
88
+ }, {
89
+ readonly reason: "record_unavailable";
90
+ readonly code: JsonRpcErrorCode.ServiceUnavailable;
91
+ readonly when: "Zenodo could not serve this record: HTTP 500 after one retry, HTTP 500 while resolving a non-Zenodo DOI, or no complete response within the time budget (its gateway cuts off near 30 s, which deposits with about 10,000 or more files hit)";
92
+ readonly thrownBy: "service";
93
+ readonly recovery: "Read the deposit’s metadata from zenodo_search_records with query doi:\"<its DOI>\" (all_versions true); withdrawn legacy records and deposits with more than about 10,000 files fail on the record endpoint, so their files cannot be read, and if a keyword search also fails, Zenodo is degraded.";
94
+ }, {
95
+ readonly reason: "rate_limited";
96
+ readonly code: JsonRpcErrorCode.RateLimited;
97
+ readonly when: "Zenodo answered HTTP 429, or this server's shared Zenodo request budget is spent for the current window";
98
+ readonly retryable: true;
99
+ readonly thrownBy: "service";
100
+ readonly recovery: "Wait for the retryAfter seconds in the error data, then call zenodo_read_file again with the same arguments.";
101
+ }], {
102
+ readonly notice: z.ZodOptional<z.ZodString>;
103
+ }>;
104
+ //# sourceMappingURL=read-file.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-file.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/read-file.tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAyCjE,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgcnB,CAAC"}