@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 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAO9B,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @fileoverview Barrel of every tool definition this server registers.
3
+ * @module mcp-server/tools/definitions
4
+ */
5
+ import { getRecord } from './get-record.tool.js';
6
+ import { listFiles } from './list-files.tool.js';
7
+ import { listVersions } from './list-versions.tool.js';
8
+ import { lookupVocabulary } from './lookup-vocabulary.tool.js';
9
+ import { readFile } from './read-file.tool.js';
10
+ import { searchRecords } from './search-records.tool.js';
11
+ export { getRecord, listFiles, listVersions, lookupVocabulary, readFile, searchRecords };
12
+ /** All tool definitions, in registration order. */
13
+ export const allToolDefinitions = [
14
+ searchRecords,
15
+ getRecord,
16
+ listVersions,
17
+ listFiles,
18
+ readFile,
19
+ lookupVocabulary,
20
+ ];
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;AAEzF,mDAAmD;AACnD,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,aAAa;IACb,SAAS;IACT,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,gBAAgB;CACjB,CAAC"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * @fileoverview zenodo_list_files — pages a Zenodo deposit's file manifest (taken
3
+ * from the record GET, which embeds the complete manifest), optionally filtered by
4
+ * key substring, or lists the members of one of its .zip files.
5
+ * @module mcp-server/tools/definitions/list-files
6
+ */
7
+ import { z } from '@cyanheads/mcp-ts-core';
8
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
9
+ export declare const listFiles: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
10
+ id: z.ZodString;
11
+ archive_key: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
12
+ key_contains: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
13
+ offset: z.ZodDefault<z.ZodNumber>;
14
+ limit: z.ZodDefault<z.ZodNumber>;
15
+ }, z.core.$strip>, z.ZodObject<{
16
+ recid: z.ZodString;
17
+ kind: z.ZodEnum<{
18
+ archive: "archive";
19
+ manifest: "manifest";
20
+ }>;
21
+ access_status: z.ZodString;
22
+ files_access: z.ZodOptional<z.ZodString>;
23
+ embargo_until: z.ZodOptional<z.ZodString>;
24
+ files_enabled: z.ZodBoolean;
25
+ key_contains: z.ZodOptional<z.ZodString>;
26
+ offset: z.ZodNumber;
27
+ limit: z.ZodNumber;
28
+ matched: z.ZodNumber;
29
+ has_more: z.ZodBoolean;
30
+ next_offset: z.ZodOptional<z.ZodNumber>;
31
+ file_count: z.ZodOptional<z.ZodNumber>;
32
+ total_bytes: z.ZodOptional<z.ZodNumber>;
33
+ entries: z.ZodOptional<z.ZodArray<z.ZodObject<{
34
+ key: z.ZodString;
35
+ size: z.ZodOptional<z.ZodNumber>;
36
+ mimetype: z.ZodOptional<z.ZodString>;
37
+ md5: z.ZodOptional<z.ZodString>;
38
+ download_url: z.ZodString;
39
+ previewable: z.ZodBoolean;
40
+ listable: z.ZodBoolean;
41
+ }, z.core.$strip>>>;
42
+ archive: z.ZodOptional<z.ZodObject<{
43
+ key: z.ZodString;
44
+ size: z.ZodOptional<z.ZodNumber>;
45
+ download_url: z.ZodString;
46
+ listed_members: z.ZodNumber;
47
+ upstream_truncated: z.ZodBoolean;
48
+ directory_count: z.ZodNumber;
49
+ }, z.core.$strip>>;
50
+ members: z.ZodOptional<z.ZodArray<z.ZodObject<{
51
+ path: z.ZodString;
52
+ size: z.ZodOptional<z.ZodNumber>;
53
+ compressed_size: z.ZodOptional<z.ZodNumber>;
54
+ mimetype: z.ZodOptional<z.ZodString>;
55
+ previewable: z.ZodBoolean;
56
+ }, z.core.$strip>>>;
57
+ }, z.core.$strip>, readonly [{
58
+ readonly reason: "invalid_identifier";
59
+ readonly code: JsonRpcErrorCode.ValidationError;
60
+ readonly when: "id matches no accepted form, or is a GitHub-badge latestdoi id or a non-zenodo.org host";
61
+ 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.";
62
+ }, {
63
+ readonly reason: "record_not_found";
64
+ readonly code: JsonRpcErrorCode.NotFound;
65
+ readonly when: "The record 404s, its metadata is restricted, or a non-Zenodo DOI is not registered to a record";
66
+ readonly recovery: "Check the id with zenodo_get_record, or find the deposit with zenodo_search_records.";
67
+ }, {
68
+ readonly reason: "record_deleted";
69
+ readonly code: JsonRpcErrorCode.NotFound;
70
+ readonly when: "The record was deleted from Zenodo; only its removal tombstone remains";
71
+ readonly recovery: "Call zenodo_get_record with this id for the removal date and reason, then find a replacement deposit with zenodo_search_records.";
72
+ }, {
73
+ readonly reason: "file_not_found";
74
+ readonly code: JsonRpcErrorCode.NotFound;
75
+ readonly when: "archive_key is not a key in the record, or Zenodo has no member listing for it";
76
+ readonly recovery: "Call zenodo_list_files without archive_key to see this record’s file keys.";
77
+ }, {
78
+ readonly reason: "not_an_archive";
79
+ readonly code: JsonRpcErrorCode.ValidationError;
80
+ readonly when: "archive_key is not a .zip";
81
+ readonly recovery: "Only .zip files can be listed; read a small text file with zenodo_read_file or fetch this file from its download_url.";
82
+ }, {
83
+ readonly reason: "archive_unavailable";
84
+ readonly code: JsonRpcErrorCode.ServiceUnavailable;
85
+ readonly when: "Zenodo cannot open the .zip named by archive_key: its member listing answered HTTP 500 after one retry, or no complete response arrived in time";
86
+ readonly thrownBy: "service";
87
+ readonly recovery: "Zenodo cannot list every .zip; download the archive from the URL in the error message (its download_url in the manifest) and list it locally, or read the record’s other 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 file manifest cannot be listed, 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_list_files again with the same arguments.";
101
+ }], {
102
+ readonly truncated: z.ZodBoolean;
103
+ readonly shown: z.ZodNumber;
104
+ readonly cap: z.ZodNumber;
105
+ readonly totalCount: z.ZodNumber;
106
+ readonly notice: z.ZodOptional<z.ZodString>;
107
+ }>;
108
+ //# sourceMappingURL=list-files.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-files.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/list-files.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAsBjE,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmZpB,CAAC"}
@@ -0,0 +1,348 @@
1
+ /**
2
+ * @fileoverview zenodo_list_files — pages a Zenodo deposit's file manifest (taken
3
+ * from the record GET, which embeds the complete manifest), optionally filtered by
4
+ * key substring, or lists the members of one of its .zip files.
5
+ * @module mcp-server/tools/definitions/list-files
6
+ */
7
+ import { tool, z } from '@cyanheads/mcp-ts-core';
8
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
9
+ import { parseRecordRef } from '../../../services/zenodo/identifiers.js';
10
+ import { isZip, previewMode } from '../../../services/zenodo/text-preview.js';
11
+ import { getZenodoService } from '../../../services/zenodo/zenodo-service.js';
12
+ import { inline } from '../render.js';
13
+ import { blankToUndefined } from '../schema-helpers.js';
14
+ /** True when zenodo_read_file reads the file rather than refusing it unread. */
15
+ const readsAsText = (key, mimetype) => previewMode(key, mimetype) !== 'binary';
16
+ const PREVIEWABLE_DESCRIPTION = 'True when zenodo_read_file reads this as text: a text MIME type or extension, or an extensionless application/octet-stream file (LICENSE, Makefile) whose content is checked on read and returned only if it is UTF-8 text.';
17
+ /** A window of `items` plus the paging facts every arm reports. */
18
+ function pageOf(items, offset, limit) {
19
+ const slice = items.slice(offset, offset + limit);
20
+ const hasMore = offset + limit < items.length;
21
+ return { slice, matched: items.length, hasMore, nextOffset: offset + limit };
22
+ }
23
+ export const listFiles = tool('zenodo_list_files', {
24
+ title: 'List Zenodo record files',
25
+ description: "Page through a Zenodo deposit's file manifest (key, size, MIME type, MD5, download URL, previewability), optionally filtered by a substring of the file key, or list the members inside one of its .zip files by setting archive_key. Restricted and embargoed files return the access status and embargo date with no entries. Read a small text file or ZIP member with zenodo_read_file.",
26
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
27
+ input: z.object({
28
+ id: z
29
+ .string()
30
+ .trim()
31
+ .min(1)
32
+ .max(500)
33
+ .describe('The deposit: a record id (22705923), a Zenodo DOI (10.5281/zenodo.22705923), another DOI registered to a Zenodo record, or a zenodo.org/records or doi.org URL. A concept id lists the latest version’s files.'),
34
+ archive_key: z
35
+ .preprocess(blankToUndefined, z.string().max(1000).optional())
36
+ .describe('Exact file key of a .zip in this record (from the manifest) to list its members instead of the manifest. Omit to list the manifest.'),
37
+ key_contains: z
38
+ .preprocess(blankToUndefined, z.string().max(200).optional())
39
+ .describe('Case-insensitive substring filter on file keys (manifest) or member paths (archive), applied before paging.'),
40
+ offset: z.number().int().min(0).default(0).describe('Entries to skip before this page.'),
41
+ limit: z.number().int().min(1).max(200).default(50).describe('Entries per page (1–200).'),
42
+ }),
43
+ output: z.object({
44
+ recid: z
45
+ .string()
46
+ .describe('Record id whose files are listed (the latest version for a concept id).'),
47
+ kind: z
48
+ .enum(['manifest', 'archive'])
49
+ .describe('manifest: the record’s files; archive: members of the .zip named by archive_key.'),
50
+ access_status: z
51
+ .string()
52
+ .describe('Record access status: open, restricted, embargoed, or metadata-only.'),
53
+ files_access: z
54
+ .string()
55
+ .optional()
56
+ .describe('File access: public or restricted; absent when Zenodo does not report it.'),
57
+ embargo_until: z.string().optional().describe('Embargo end date, when an embargo is active.'),
58
+ files_enabled: z.boolean().describe('False for a metadata-only deposit.'),
59
+ key_contains: z.string().optional().describe('The key filter applied, when set.'),
60
+ offset: z.number().describe('Entries skipped before this page.'),
61
+ limit: z.number().describe('Page size applied.'),
62
+ matched: z.number().describe('Entries matching the filter, before paging.'),
63
+ has_more: z.boolean().describe('True when more matching entries follow this page.'),
64
+ next_offset: z.number().optional().describe('Offset of the next page, when has_more.'),
65
+ file_count: z
66
+ .number()
67
+ .optional()
68
+ .describe('Total files in the record (manifest kind); absent when files are restricted or embargoed.'),
69
+ total_bytes: z
70
+ .number()
71
+ .optional()
72
+ .describe('Total size of the record’s files in bytes (manifest kind); absent when files are restricted or embargoed.'),
73
+ entries: z
74
+ .array(z
75
+ .object({
76
+ key: z.string().describe('File key — pass to zenodo_read_file as key.'),
77
+ size: z.number().optional().describe('Size in bytes, when reported.'),
78
+ mimetype: z.string().optional().describe('MIME type, when reported.'),
79
+ md5: z.string().optional().describe('MD5 checksum (hex), when reported.'),
80
+ download_url: z.string().describe('Direct download URL.'),
81
+ previewable: z.boolean().describe(PREVIEWABLE_DESCRIPTION),
82
+ listable: z
83
+ .boolean()
84
+ .describe('True for a .zip, whose members zenodo_list_files lists when given this key as archive_key.'),
85
+ })
86
+ .describe('One file in the manifest.'))
87
+ .optional()
88
+ .describe('Manifest files on this page (manifest kind); empty when files are restricted.'),
89
+ archive: z
90
+ .object({
91
+ key: z.string().describe('The .zip file key.'),
92
+ size: z.number().optional().describe('Size of the .zip in bytes, when reported.'),
93
+ download_url: z
94
+ .string()
95
+ .describe('Direct download URL of the .zip — the complete member list needs the file.'),
96
+ listed_members: z.number().describe('File members Zenodo listed for this archive.'),
97
+ upstream_truncated: z
98
+ .boolean()
99
+ .describe('True when Zenodo cut the listing at 1,000 nodes (files plus directories), so members are missing.'),
100
+ directory_count: z.number().describe('Directories Zenodo listed for this archive.'),
101
+ })
102
+ .optional()
103
+ .describe('The archive being listed (archive kind); absent when files are restricted.'),
104
+ members: z
105
+ .array(z
106
+ .object({
107
+ path: z
108
+ .string()
109
+ .describe('Member path inside the archive — pass to zenodo_read_file as archive_member.'),
110
+ size: z.number().optional().describe('Uncompressed size in bytes, when reported.'),
111
+ compressed_size: z
112
+ .number()
113
+ .optional()
114
+ .describe('Compressed size in bytes, when reported.'),
115
+ mimetype: z.string().optional().describe('MIME type, when reported.'),
116
+ previewable: z.boolean().describe(PREVIEWABLE_DESCRIPTION),
117
+ })
118
+ .describe('One archive member.'))
119
+ .optional()
120
+ .describe('Archive members on this page (archive kind); empty when files are restricted.'),
121
+ }),
122
+ enrichment: {
123
+ truncated: z.boolean().describe('True when more matching entries follow this page.'),
124
+ shown: z.number().describe('Entries returned on this page.'),
125
+ cap: z.number().describe('Page size applied.'),
126
+ totalCount: z.number().describe('Entries matching the filter, before paging.'),
127
+ notice: z
128
+ .string()
129
+ .optional()
130
+ .describe('File access notes, empty-filter guidance, listing caps, or paging guidance.'),
131
+ },
132
+ errors: [
133
+ {
134
+ reason: 'invalid_identifier',
135
+ code: JsonRpcErrorCode.ValidationError,
136
+ when: 'id matches no accepted form, or is a GitHub-badge latestdoi id or a non-zenodo.org host',
137
+ 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.',
138
+ },
139
+ {
140
+ reason: 'record_not_found',
141
+ code: JsonRpcErrorCode.NotFound,
142
+ when: 'The record 404s, its metadata is restricted, or a non-Zenodo DOI is not registered to a record',
143
+ recovery: 'Check the id with zenodo_get_record, or find the deposit with zenodo_search_records.',
144
+ },
145
+ {
146
+ reason: 'record_deleted',
147
+ code: JsonRpcErrorCode.NotFound,
148
+ when: 'The record was deleted from Zenodo; only its removal tombstone remains',
149
+ recovery: 'Call zenodo_get_record with this id for the removal date and reason, then find a replacement deposit with zenodo_search_records.',
150
+ },
151
+ {
152
+ reason: 'file_not_found',
153
+ code: JsonRpcErrorCode.NotFound,
154
+ when: 'archive_key is not a key in the record, or Zenodo has no member listing for it',
155
+ recovery: 'Call zenodo_list_files without archive_key to see this record’s file keys.',
156
+ },
157
+ {
158
+ reason: 'not_an_archive',
159
+ code: JsonRpcErrorCode.ValidationError,
160
+ when: 'archive_key is not a .zip',
161
+ recovery: 'Only .zip files can be listed; read a small text file with zenodo_read_file or fetch this file from its download_url.',
162
+ },
163
+ {
164
+ reason: 'archive_unavailable',
165
+ code: JsonRpcErrorCode.ServiceUnavailable,
166
+ when: 'Zenodo cannot open the .zip named by archive_key: its member listing answered HTTP 500 after one retry, or no complete response arrived in time',
167
+ thrownBy: 'service',
168
+ recovery: 'Zenodo cannot list every .zip; download the archive from the URL in the error message (its download_url in the manifest) and list it locally, or read the record’s other files with zenodo_read_file.',
169
+ },
170
+ {
171
+ reason: 'record_unavailable',
172
+ code: JsonRpcErrorCode.ServiceUnavailable,
173
+ 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)',
174
+ thrownBy: 'service',
175
+ 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 file manifest cannot be listed, and if a keyword search also fails, Zenodo is degraded.',
176
+ },
177
+ {
178
+ reason: 'rate_limited',
179
+ code: JsonRpcErrorCode.RateLimited,
180
+ when: "Zenodo answered HTTP 429, or this server's shared Zenodo request budget is spent for the current window",
181
+ retryable: true,
182
+ thrownBy: 'service',
183
+ recovery: 'Wait for the retryAfter seconds in the error data, then call zenodo_list_files again with the same arguments.',
184
+ },
185
+ ],
186
+ async handler(input, ctx) {
187
+ ctx.enrich({ truncated: false, shown: 0, cap: input.limit, totalCount: 0 });
188
+ const ref = parseRecordRef(input.id);
189
+ if (ref.kind === 'invalid') {
190
+ throw ctx.fail('invalid_identifier', ref.message, ctx.recoveryFor('invalid_identifier'));
191
+ }
192
+ const service = getZenodoService();
193
+ let record;
194
+ if (ref.kind === 'external_doi') {
195
+ const resolution = await service.resolveDoi(ref.doi, ref.strippedDoi, ctx);
196
+ if (resolution.status === 'not_on_zenodo') {
197
+ throw ctx.fail('record_not_found', `DOI ${ref.strippedDoi ?? ref.doi} is not registered to a Zenodo record.`, ctx.recoveryFor('record_not_found'));
198
+ }
199
+ record = resolution.record;
200
+ }
201
+ else {
202
+ const lookup = await service.getRecord(ref.recid, ctx);
203
+ if (lookup.status === 'deleted') {
204
+ throw ctx.fail('record_deleted', `Record ${ref.recid} was deleted from Zenodo; only its tombstone remains.`, ctx.recoveryFor('record_deleted'));
205
+ }
206
+ if (lookup.status !== 'found') {
207
+ throw ctx.fail('record_not_found', lookup.status === 'restricted'
208
+ ? `Record ${ref.recid} exists but its metadata is restricted and cannot be read anonymously.`
209
+ : `No Zenodo record has id ${ref.recid}.`, ctx.recoveryFor('record_not_found'));
210
+ }
211
+ record = lookup.record;
212
+ }
213
+ const { access, files } = record;
214
+ const archiveKey = input.archive_key;
215
+ const common = {
216
+ recid: record.recid,
217
+ kind: archiveKey ? 'archive' : 'manifest',
218
+ access_status: access.status,
219
+ ...(access.files ? { files_access: access.files } : {}),
220
+ ...(access.embargo_until ? { embargo_until: access.embargo_until } : {}),
221
+ files_enabled: files.enabled,
222
+ ...(input.key_contains ? { key_contains: input.key_contains } : {}),
223
+ offset: input.offset,
224
+ limit: input.limit,
225
+ };
226
+ const needle = input.key_contains?.toLowerCase();
227
+ if (files.enabled && access.files === 'restricted') {
228
+ const until = access.embargo_until ? ` until ${access.embargo_until}` : '';
229
+ ctx.enrich.notice(`Files are ${access.status}${until}; only metadata is available. zenodo_get_record shows the access details.`);
230
+ return {
231
+ ...common,
232
+ matched: 0,
233
+ has_more: false,
234
+ ...(archiveKey ? { members: [] } : { entries: [] }),
235
+ };
236
+ }
237
+ const notice = [];
238
+ const finish = (page, noun, partialListing = false) => {
239
+ ctx.enrich({ shown: page.slice.length });
240
+ ctx.enrich.total(page.matched);
241
+ if (needle && page.matched === 0) {
242
+ const filter = inline(input.key_contains ?? '');
243
+ notice.push(partialListing
244
+ ? `No listed members contain "${filter}", but the member may lie past the listing cap: if you know its full path, read it directly with zenodo_read_file (key ${inline(archiveKey ?? '')}, archive_member set to that path).`
245
+ : `No ${noun} contain "${filter}"; call zenodo_list_files again without key_contains.`);
246
+ }
247
+ else if (page.matched > 0 && input.offset >= page.matched) {
248
+ notice.push(`Offset ${input.offset} is past the last of ${page.matched} ${noun}; call again with a lower offset.`);
249
+ }
250
+ if (page.hasMore) {
251
+ notice.push(`Showing ${page.slice.length} of ${page.matched}; call again with offset ${page.nextOffset}.`);
252
+ ctx.enrich.truncated({
253
+ shown: page.slice.length,
254
+ cap: input.limit,
255
+ guidance: notice.join(' '),
256
+ });
257
+ }
258
+ else if (notice.length) {
259
+ ctx.enrich.notice(notice.join(' '));
260
+ }
261
+ return {
262
+ matched: page.matched,
263
+ has_more: page.hasMore,
264
+ ...(page.hasMore ? { next_offset: page.nextOffset } : {}),
265
+ };
266
+ };
267
+ if (!archiveKey) {
268
+ if (!files.enabled)
269
+ notice.push('This record has no files (metadata-only deposit).');
270
+ const matching = needle
271
+ ? files.entries.filter((e) => e.key.toLowerCase().includes(needle))
272
+ : files.entries;
273
+ const page = pageOf(matching, input.offset, input.limit);
274
+ const paging = finish(page, 'files');
275
+ return {
276
+ ...common,
277
+ ...paging,
278
+ ...(files.count !== undefined ? { file_count: files.count } : {}),
279
+ ...(files.total_bytes !== undefined ? { total_bytes: files.total_bytes } : {}),
280
+ entries: page.slice.map((e) => ({
281
+ ...e,
282
+ previewable: readsAsText(e.key, e.mimetype),
283
+ listable: isZip(e.key, e.mimetype),
284
+ })),
285
+ };
286
+ }
287
+ const entry = files.entries.find((e) => e.key === archiveKey);
288
+ if (!entry) {
289
+ throw ctx.fail('file_not_found', files.enabled
290
+ ? `Record ${record.recid} has no file with key "${inline(archiveKey)}".`
291
+ : `Record ${record.recid} is a metadata-only deposit with no files.`, ctx.recoveryFor('file_not_found'));
292
+ }
293
+ if (!isZip(entry.key, entry.mimetype)) {
294
+ throw ctx.fail('not_an_archive', `"${inline(archiveKey)}" is not a .zip file${entry.mimetype ? ` (${entry.mimetype})` : ''}; only ZIP archives can be listed.`, ctx.recoveryFor('not_an_archive'));
295
+ }
296
+ const container = await service.getContainer(record.recid, entry.key, ctx);
297
+ if (container.status === 'not_found') {
298
+ throw ctx.fail('file_not_found', `Zenodo has no member listing for "${inline(archiveKey)}" in record ${record.recid}.`, ctx.recoveryFor('file_not_found'));
299
+ }
300
+ const { listing } = container;
301
+ if (listing.upstream_truncated) {
302
+ notice.push('Zenodo lists at most 1,000 entries of an archive, so some members are missing from this listing; download the archive from archive.download_url for the complete list.');
303
+ }
304
+ const matching = needle
305
+ ? listing.members.filter((m) => m.path.toLowerCase().includes(needle))
306
+ : listing.members;
307
+ const page = pageOf(matching, input.offset, input.limit);
308
+ const paging = finish(page, 'members', listing.upstream_truncated);
309
+ return {
310
+ ...common,
311
+ ...paging,
312
+ archive: {
313
+ key: entry.key,
314
+ ...(entry.size !== undefined ? { size: entry.size } : {}),
315
+ download_url: entry.download_url,
316
+ listed_members: listing.members.length,
317
+ upstream_truncated: listing.upstream_truncated,
318
+ directory_count: listing.directory_count,
319
+ },
320
+ members: page.slice.map((m) => ({ ...m, previewable: readsAsText(m.path, m.mimetype) })),
321
+ };
322
+ },
323
+ format: (result) => {
324
+ const lines = [
325
+ `## Zenodo record ${result.recid} — ${result.kind === 'archive' ? 'archive members' : 'files'}`,
326
+ `**Kind:** ${result.kind} | **Access:** ${inline(result.access_status)}${result.files_access ? `, files ${inline(result.files_access)}` : ''}${result.embargo_until ? `, embargoed until ${inline(result.embargo_until)}` : ''} | **Files enabled:** ${result.files_enabled}`,
327
+ ];
328
+ const totals = [
329
+ result.file_count !== undefined ? `**File count:** ${result.file_count}` : undefined,
330
+ result.total_bytes !== undefined ? `**Total bytes:** ${result.total_bytes}` : undefined,
331
+ ].filter(Boolean);
332
+ if (totals.length)
333
+ lines.push(totals.join(' | '));
334
+ lines.push(`**Matched:** ${result.matched}${result.key_contains ? ` (key contains "${inline(result.key_contains)}")` : ''} | **Offset:** ${result.offset} | **Limit:** ${result.limit} | **Has more:** ${result.has_more}${result.next_offset !== undefined ? ` | **Next offset:** ${result.next_offset}` : ''}`);
335
+ const a = result.archive;
336
+ if (a) {
337
+ lines.push(`**Archive:** ${inline(a.key)} (${a.size ?? '?'} bytes) — ${a.listed_members} members and ${a.directory_count} directories listed; upstream truncated: ${a.upstream_truncated} — ${a.download_url}`);
338
+ }
339
+ for (const e of result.entries ?? []) {
340
+ lines.push(`- ${inline(e.key)} — ${e.size ?? '?'} bytes${e.mimetype ? `, ${inline(e.mimetype)}` : ''}${e.md5 ? `, md5 ${inline(e.md5)}` : ''}; previewable: ${e.previewable}; listable: ${e.listable} — ${e.download_url}`);
341
+ }
342
+ for (const m of result.members ?? []) {
343
+ lines.push(`- ${inline(m.path)} — ${m.size ?? '?'} bytes (compressed ${m.compressed_size ?? '?'})${m.mimetype ? `, ${inline(m.mimetype)}` : ''}; previewable: ${m.previewable}`);
344
+ }
345
+ return [{ type: 'text', text: lines.join('\n') }];
346
+ },
347
+ });
348
+ //# sourceMappingURL=list-files.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-files.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/list-files.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,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,gFAAgF;AAChF,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,QAA4B,EAAE,EAAE,CAChE,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,QAAQ,CAAC;AAE1C,MAAM,uBAAuB,GAC3B,6NAA6N,CAAC;AAEhO,mEAAmE;AACnE,SAAS,MAAM,CAAI,KAAU,EAAE,MAAc,EAAE,KAAa;IAC1D,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAA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AAI,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;YACrC,KAAK,CAAC,IAAI,CACR,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,IAAI,GAAG,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,WAAW,eAAe,CAAC,CAAC,QAAQ,MAAM,CAAC,CAAC,YAAY,EAAE,CAChN,CAAC;QACJ,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;YACrC,KAAK,CAAC,IAAI,CACR,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,IAAI,GAAG,sBAAsB,CAAC,CAAC,eAAe,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,WAAW,EAAE,CACrK,CAAC;QACJ,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,92 @@
1
+ /**
2
+ * @fileoverview zenodo_list_versions — lists a Zenodo deposit's version series,
3
+ * newest first. Accepts every identifier form zenodo_get_record accepts; a miss
4
+ * (unknown id, deleted record, restricted metadata, DOI not on Zenodo) is a result.
5
+ * @module mcp-server/tools/definitions/list-versions
6
+ */
7
+ import { z } from '@cyanheads/mcp-ts-core';
8
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
9
+ export declare const listVersions: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
10
+ id: z.ZodString;
11
+ page: z.ZodDefault<z.ZodNumber>;
12
+ size: z.ZodDefault<z.ZodNumber>;
13
+ }, z.core.$strip>, z.ZodObject<{
14
+ found: z.ZodBoolean;
15
+ input_kind: z.ZodEnum<{
16
+ external_doi: "external_doi";
17
+ record_id: "record_id";
18
+ url: "url";
19
+ zenodo_doi: "zenodo_doi";
20
+ }>;
21
+ miss_kind: z.ZodOptional<z.ZodEnum<{
22
+ deleted: "deleted";
23
+ not_found: "not_found";
24
+ not_on_zenodo: "not_on_zenodo";
25
+ restricted: "restricted";
26
+ }>>;
27
+ guidance: z.ZodOptional<z.ZodString>;
28
+ tombstone: z.ZodOptional<z.ZodObject<{
29
+ removal_date: z.ZodOptional<z.ZodString>;
30
+ removal_reason: z.ZodOptional<z.ZodString>;
31
+ note: z.ZodOptional<z.ZodString>;
32
+ citation_text: z.ZodOptional<z.ZodString>;
33
+ }, z.core.$strip>>;
34
+ concept_recid: z.ZodOptional<z.ZodString>;
35
+ concept_doi: z.ZodOptional<z.ZodString>;
36
+ total_versions: z.ZodOptional<z.ZodNumber>;
37
+ latest_recid: z.ZodOptional<z.ZodString>;
38
+ page: z.ZodNumber;
39
+ size: z.ZodNumber;
40
+ has_more: z.ZodBoolean;
41
+ next_page: z.ZodOptional<z.ZodNumber>;
42
+ versions: z.ZodArray<z.ZodObject<{
43
+ recid: z.ZodString;
44
+ doi: z.ZodOptional<z.ZodString>;
45
+ version: z.ZodOptional<z.ZodString>;
46
+ title: z.ZodString;
47
+ publication_date: z.ZodOptional<z.ZodString>;
48
+ index: z.ZodOptional<z.ZodNumber>;
49
+ is_latest: z.ZodOptional<z.ZodBoolean>;
50
+ file_count: z.ZodOptional<z.ZodNumber>;
51
+ total_bytes: z.ZodOptional<z.ZodNumber>;
52
+ views: z.ZodOptional<z.ZodNumber>;
53
+ downloads: z.ZodOptional<z.ZodNumber>;
54
+ }, z.core.$strip>>;
55
+ }, z.core.$strip>, readonly [{
56
+ readonly reason: "invalid_identifier";
57
+ readonly code: JsonRpcErrorCode.ValidationError;
58
+ readonly when: "id matches no accepted form, or is a GitHub-badge latestdoi id or a non-zenodo.org host";
59
+ 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.";
60
+ }, {
61
+ readonly reason: "result_window_exceeded";
62
+ readonly code: JsonRpcErrorCode.ValidationError;
63
+ readonly when: "page × size exceeds 10,000";
64
+ readonly recovery: "Zenodo pages only the first 10,000 versions of a series, and no series comes near that; call zenodo_list_versions with page 1 (total_versions and has_more show how far the series goes).";
65
+ }, {
66
+ readonly reason: "record_unavailable";
67
+ readonly code: JsonRpcErrorCode.ServiceUnavailable;
68
+ readonly when: "Zenodo could not serve this record or its versions page: HTTP 500 after one retry, HTTP 500 while resolving a non-Zenodo DOI, or no complete record response within the time budget (its gateway cuts off near 30 s, which deposits with about 10,000 or more files hit)";
69
+ readonly thrownBy: "service";
70
+ readonly recovery: "Look the record up with zenodo_search_records using query doi:\"<its DOI>\" (all_versions true) or its title; withdrawn legacy records and deposits with more than about 10,000 files fail on the record endpoint, and if a keyword search also fails, Zenodo is degraded.";
71
+ }, {
72
+ readonly reason: "upstream_timeout";
73
+ readonly code: JsonRpcErrorCode.Timeout;
74
+ readonly when: "The versions page got no complete response within its time budget";
75
+ readonly retryable: false;
76
+ readonly thrownBy: "service";
77
+ readonly recovery: "Call zenodo_list_versions again with a smaller size (5); this series holds large file manifests.";
78
+ }, {
79
+ readonly reason: "rate_limited";
80
+ readonly code: JsonRpcErrorCode.RateLimited;
81
+ readonly when: "Zenodo answered HTTP 429, or this server's shared Zenodo request budget is spent for the current window";
82
+ readonly retryable: true;
83
+ readonly thrownBy: "service";
84
+ readonly recovery: "Wait for the retryAfter seconds in the error data, then call zenodo_list_versions again with the same arguments.";
85
+ }], {
86
+ readonly truncated: z.ZodBoolean;
87
+ readonly shown: z.ZodNumber;
88
+ readonly cap: z.ZodNumber;
89
+ readonly totalCount: z.ZodNumber;
90
+ readonly notice: z.ZodOptional<z.ZodString>;
91
+ }>;
92
+ //# sourceMappingURL=list-versions.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-versions.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/list-versions.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAUjE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuSvB,CAAC"}