@burdenoff/mcp-libs 2026.1031.1 → 2026.1031.3

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 (64) hide show
  1. package/dist/modules/auth/index.cjs +1 -1
  2. package/dist/modules/auth/index.cjs.map +1 -1
  3. package/dist/modules/auth/index.js +1 -1
  4. package/dist/modules/auth/index.js.map +1 -1
  5. package/dist/modules/auth/operations.d.ts +2 -2
  6. package/dist/modules/billing/index.cjs +45 -19
  7. package/dist/modules/billing/index.cjs.map +1 -1
  8. package/dist/modules/billing/index.js +45 -19
  9. package/dist/modules/billing/index.js.map +1 -1
  10. package/dist/modules/billing/operations.d.ts +4 -4
  11. package/dist/modules/channels/index.cjs +0 -35
  12. package/dist/modules/channels/index.cjs.map +1 -1
  13. package/dist/modules/channels/index.js +0 -35
  14. package/dist/modules/channels/index.js.map +1 -1
  15. package/dist/modules/channels/operations.d.ts +0 -1
  16. package/dist/modules/conversations/index.cjs +6 -6
  17. package/dist/modules/conversations/index.cjs.map +1 -1
  18. package/dist/modules/conversations/index.js +6 -6
  19. package/dist/modules/conversations/index.js.map +1 -1
  20. package/dist/modules/conversations/operations.d.ts +1 -1
  21. package/dist/modules/cosmicintersection/index.cjs +49 -3
  22. package/dist/modules/cosmicintersection/index.cjs.map +1 -1
  23. package/dist/modules/cosmicintersection/index.js +49 -3
  24. package/dist/modules/cosmicintersection/index.js.map +1 -1
  25. package/dist/modules/cosmicintersection/operations.d.ts +5 -4
  26. package/dist/modules/files/index.cjs +421 -101
  27. package/dist/modules/files/index.cjs.map +1 -1
  28. package/dist/modules/files/index.js +412 -97
  29. package/dist/modules/files/index.js.map +1 -1
  30. package/dist/modules/files/operations.d.ts +9 -8
  31. package/dist/modules/files/tools.d.ts +2 -0
  32. package/dist/modules/products/index.cjs +1 -1
  33. package/dist/modules/products/index.cjs.map +1 -1
  34. package/dist/modules/products/index.js +1 -1
  35. package/dist/modules/products/index.js.map +1 -1
  36. package/dist/modules/products/operations.d.ts +1 -1
  37. package/dist/modules/rbac/index.cjs +0 -64
  38. package/dist/modules/rbac/index.cjs.map +1 -1
  39. package/dist/modules/rbac/index.js +0 -64
  40. package/dist/modules/rbac/index.js.map +1 -1
  41. package/dist/modules/rbac/operations.d.ts +0 -2
  42. package/dist/modules/scheduler/index.cjs +4 -4
  43. package/dist/modules/scheduler/index.cjs.map +1 -1
  44. package/dist/modules/scheduler/index.js +4 -4
  45. package/dist/modules/scheduler/index.js.map +1 -1
  46. package/dist/modules/scheduler/operations.d.ts +3 -3
  47. package/dist/modules/tags/index.cjs +454 -48
  48. package/dist/modules/tags/index.cjs.map +1 -1
  49. package/dist/modules/tags/index.js +443 -42
  50. package/dist/modules/tags/index.js.map +1 -1
  51. package/dist/modules/tags/operations.d.ts +10 -6
  52. package/dist/modules/tags/tools.d.ts +1 -1
  53. package/dist/modules/vibecontrols/index.cjs +8 -8
  54. package/dist/modules/vibecontrols/index.cjs.map +1 -1
  55. package/dist/modules/vibecontrols/index.js +8 -8
  56. package/dist/modules/vibecontrols/index.js.map +1 -1
  57. package/dist/modules/workspaces/index.cjs +235 -5
  58. package/dist/modules/workspaces/index.cjs.map +1 -1
  59. package/dist/modules/workspaces/index.js +224 -6
  60. package/dist/modules/workspaces/index.js.map +1 -1
  61. package/dist/modules/workspaces/operations.d.ts +2 -2
  62. package/dist/modules/workspaces/prompts.d.ts +3 -0
  63. package/dist/modules/workspaces/resources.d.ts +4 -0
  64. package/package.json +1 -1
@@ -3,7 +3,7 @@ export declare const DATASET_FIELDS = "\n id name description status accessLeve
3
3
  export declare const SCHEMA_FIELD_FIELDS = "\n id datasetId name fieldType description nullable position provenance unit\n createdAt updatedAt workspaceId\n";
4
4
  export declare const COLLECTION_FIELDS = "\n id name slug description isPublic tags createdAt updatedAt workspaceId\n";
5
5
  export declare const PIPELINE_FIELDS = "\n id name description status trigger schedule definition version lastRunAt\n tags createdAt updatedAt workspaceId\n";
6
- export declare const STEP_FIELDS = "\n id runId name kind status position inputs outputs logsRef durationMs\n startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n";
6
+ export declare const STEP_FIELDS = "\n id runId name kind status position inputs outputs producedDatasetIds logsRef\n durationMs startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n";
7
7
  export declare const RUN_FIELDS = "\n id pipelineId runNumber status params metrics datasetId triggeredBy\n durationMs startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n";
8
8
  export declare const NOTEBOOK_FIELDS = "\n id title description status runtime environment datasetIds isShared\n shareSlug tags createdAt updatedAt workspaceId\n";
9
9
  export declare const ANALYSIS_FIELDS = "\n id title status method aiAssisted datasetId notebookId results\n errorMessage startedAt finishedAt createdAt updatedAt workspaceId\n";
@@ -30,12 +30,13 @@ export declare const LIST_PIPELINES = "\n query CosmicintersectionListPipelines
30
30
  export declare const CREATE_PIPELINE = "\n mutation CosmicintersectionCreatePipeline($input: CosCreatePipelineInput!) {\n cosCreatePipeline(input: $input) {\n \n id name description status trigger schedule definition version lastRunAt\n tags createdAt updatedAt workspaceId\n\n }\n }\n";
31
31
  export declare const UPDATE_PIPELINE = "\n mutation CosmicintersectionUpdatePipeline($id: ID!, $input: CosUpdatePipelineInput!) {\n cosUpdatePipeline(id: $id, input: $input) {\n \n id name description status trigger schedule definition version lastRunAt\n tags createdAt updatedAt workspaceId\n\n }\n }\n";
32
32
  export declare const ARCHIVE_PIPELINE = "\n mutation CosmicintersectionArchivePipeline($id: ID!) {\n cosArchivePipeline(id: $id)\n }\n";
33
- export declare const GET_RUN = "\n query CosmicintersectionGetRun($id: ID!) {\n cosRun(id: $id) {\n \n id pipelineId runNumber status params metrics datasetId triggeredBy\n durationMs startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n\n pipeline { id name status }\n steps { \n id runId name kind status position inputs outputs logsRef durationMs\n startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n }\n }\n }\n";
33
+ export declare const GET_RUN = "\n query CosmicintersectionGetRun($id: ID!) {\n cosRun(id: $id) {\n \n id pipelineId runNumber status params metrics datasetId triggeredBy\n durationMs startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n\n pipeline { id name status }\n steps { \n id runId name kind status position inputs outputs producedDatasetIds logsRef\n durationMs startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n }\n }\n }\n";
34
34
  export declare const LIST_RUNS = "\n query CosmicintersectionListRuns(\n $pipelineId: ID\n $status: CosRunStatus\n $pagination: PaginationInput\n ) {\n cosListRuns(pipelineId: $pipelineId, status: $status, pagination: $pagination) {\n items { \n id pipelineId runNumber status params metrics datasetId triggeredBy\n durationMs startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n }\n pageInfo { cursor hasMore }\n }\n }\n";
35
35
  export declare const START_RUN = "\n mutation CosmicintersectionStartRun($input: CosStartRunInput!) {\n cosStartRun(input: $input) {\n \n id pipelineId runNumber status params metrics datasetId triggeredBy\n durationMs startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n\n }\n }\n";
36
36
  export declare const TRANSITION_RUN = "\n mutation CosmicintersectionTransitionRun($id: ID!, $status: CosRunStatus!) {\n cosTransitionRun(id: $id, status: $status) {\n \n id pipelineId runNumber status params metrics datasetId triggeredBy\n durationMs startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n\n }\n }\n";
37
- export declare const LIST_RUN_STEPS = "\n query CosmicintersectionListRunSteps($runId: ID!) {\n cosListRunSteps(runId: $runId) {\n \n id runId name kind status position inputs outputs logsRef durationMs\n startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n\n }\n }\n";
38
- export declare const ADD_RUN_STEP = "\n mutation CosmicintersectionAddRunStep($input: CosAddRunStepInput!) {\n cosAddRunStep(input: $input) {\n \n id runId name kind status position inputs outputs logsRef durationMs\n startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n\n }\n }\n";
37
+ export declare const LIST_RUN_STEPS = "\n query CosmicintersectionListRunSteps($runId: ID!) {\n cosListRunSteps(runId: $runId) {\n \n id runId name kind status position inputs outputs producedDatasetIds logsRef\n durationMs startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n\n }\n }\n";
38
+ export declare const ADD_RUN_STEP = "\n mutation CosmicintersectionAddRunStep($input: CosAddRunStepInput!) {\n cosAddRunStep(input: $input) {\n \n id runId name kind status position inputs outputs producedDatasetIds logsRef\n durationMs startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n\n }\n }\n";
39
+ export declare const COMPLETE_RUN_STEP = "\n mutation CosmicintersectionCompleteRunStep(\n $runId: ID!\n $stepId: ID!\n $input: CosCompleteRunStepInput!\n ) {\n cosCompleteRunStep(runId: $runId, stepId: $stepId, input: $input) {\n \n id runId name kind status position inputs outputs producedDatasetIds logsRef\n durationMs startedAt finishedAt errorMessage createdAt updatedAt workspaceId\n\n }\n }\n";
39
40
  export declare const GET_NOTEBOOK = "\n query CosmicintersectionGetNotebook($id: ID!) {\n cosNotebook(id: $id) {\n \n id title description status runtime environment datasetIds isShared\n shareSlug tags createdAt updatedAt workspaceId\n\n analyses { \n id title status method aiAssisted datasetId notebookId results\n errorMessage startedAt finishedAt createdAt updatedAt workspaceId\n }\n releases { id title version status }\n }\n }\n";
40
41
  export declare const LIST_NOTEBOOKS = "\n query CosmicintersectionListNotebooks(\n $status: CosNotebookStatus\n $pagination: PaginationInput\n ) {\n cosListNotebooks(status: $status, pagination: $pagination) {\n items { \n id title description status runtime environment datasetIds isShared\n shareSlug tags createdAt updatedAt workspaceId\n }\n pageInfo { cursor hasMore }\n }\n }\n";
41
42
  export declare const CREATE_NOTEBOOK = "\n mutation CosmicintersectionCreateNotebook($input: CosCreateNotebookInput!) {\n cosCreateNotebook(input: $input) {\n \n id title description status runtime environment datasetIds isShared\n shareSlug tags createdAt updatedAt workspaceId\n\n }\n }\n";
@@ -12,8 +12,8 @@ require('crypto');
12
12
  // src/core/errors.ts
13
13
  var McpInternalError = class extends Error {
14
14
  cause;
15
- constructor(message, cause) {
16
- super(message);
15
+ constructor(message2, cause) {
16
+ super(message2);
17
17
  this.name = "McpInternalError";
18
18
  this.cause = cause;
19
19
  }
@@ -38,131 +38,451 @@ function mcpToolName(productName, ...parts) {
38
38
  }
39
39
 
40
40
  // src/core/result.ts
41
- function errorResult(message, hint) {
42
- const text = hint ? `${message}
41
+ function jsonResult(data, structured) {
42
+ const result = {
43
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
44
+ };
45
+ return result;
46
+ }
47
+ function errorResult(message2, hint) {
48
+ const text = hint ? `${message2}
43
49
 
44
- Hint: ${hint}` : message;
50
+ Hint: ${hint}` : message2;
45
51
  return { content: [{ type: "text", text }], isError: true };
46
52
  }
47
53
 
54
+ // src/modules/files/operations.ts
55
+ var FILE_FIELDS = `
56
+ id name description workspaceId folderId
57
+ mimeType extension size
58
+ status visibility starred downloadCount viewCount sha256Hash
59
+ uploadedById createdAt updatedAt tags
60
+ `;
61
+ var LIST_FILES = `
62
+ query GetFiles($folderId: ID, $filter: FileFilterInput, $pagination: PaginationInput) {
63
+ getFiles(folderId: $folderId, filter: $filter, pagination: $pagination) {
64
+ files { ${FILE_FIELDS} }
65
+ total page limit hasMore
66
+ }
67
+ }
68
+ `;
69
+ var GET_FILE = `
70
+ query GetFile($id: ID!) {
71
+ getFile(id: $id) { ${FILE_FIELDS} }
72
+ }
73
+ `;
74
+ var GET_FOLDER = `
75
+ query GetFolder($id: ID!) {
76
+ getFolder(id: $id) {
77
+ id name description path level parentFolderId visibility starred
78
+ filesCount subfoldersCount createdAt updatedAt
79
+ }
80
+ }
81
+ `;
82
+ var LIST_FOLDERS = `
83
+ query GetFolders($filter: FolderFilterInput, $pagination: PaginationInput) {
84
+ getFolders(filter: $filter, pagination: $pagination) {
85
+ folders { id name path level parentFolderId filesCount subfoldersCount updatedAt }
86
+ total page limit hasMore
87
+ }
88
+ }
89
+ `;
90
+ var GET_FILE_DOWNLOAD_URL = `
91
+ query GetFileDownloadUrl($id: ID!, $expiresIn: Int) {
92
+ getFileDownloadUrl(id: $id, expiresIn: $expiresIn)
93
+ }
94
+ `;
95
+ var UPLOAD_FILE = `
96
+ mutation UploadFile($input: UploadFileInput!) {
97
+ uploadFile(input: $input) {
98
+ file { ${FILE_FIELDS} }
99
+ uploadProgress
100
+ message
101
+ }
102
+ }
103
+ `;
104
+ var INITIATE_UPLOAD = `
105
+ mutation InitiateUpload($input: InitiateUploadInput!) {
106
+ initiateUpload(input: $input) {
107
+ session { id fileName fileSize status expiresAt uploadType partSize totalParts }
108
+ uploadUrl
109
+ presignedUrls { partNumber url expiresAt }
110
+ multipartUploadId
111
+ }
112
+ }
113
+ `;
114
+ var COMPLETE_UPLOAD = `
115
+ mutation CompleteUpload($input: CompleteUploadInput!) {
116
+ completeUpload(input: $input) {
117
+ fileId
118
+ message
119
+ file { ${FILE_FIELDS} }
120
+ }
121
+ }
122
+ `;
123
+ var CREATE_SHARE = `
124
+ mutation CreateShare($input: FileCreateShareInput!) {
125
+ createShare(input: $input) {
126
+ id fileId token shareType accessLevel expiresAt requiresPassword
127
+ invitedEmail invitedUserIds downloadCount maxDownloads createdAt
128
+ }
129
+ }
130
+ `;
131
+ var REVOKE_SHARE = `
132
+ mutation RevokeShare($id: ID!) {
133
+ revokeShare(id: $id) {
134
+ id fileId revokedAt revokedBy
135
+ }
136
+ }
137
+ `;
138
+
48
139
  // src/modules/files/tools.ts
49
- function stubbedTool(server, toolName, title, description, featureNote, inputSchema, altSuggestions) {
50
- server.registerTool(
51
- toolName,
52
- {
53
- title,
54
- description: `${description} [STUB]`,
55
- inputSchema
56
- },
57
- async () => errorResult(
58
- `[stubbed] ${featureNote} Use ${altSuggestions.join(", ")} instead. The tool remains registered so callers receive a meaningful response instead of a schema-validation error.`
59
- )
60
- );
140
+ var MAX_DOWNLOAD_URL_TTL_SECONDS = 604800;
141
+ var VisibilityEnum = zod.z.enum(["PRIVATE", "TEAM", "WORKSPACE", "PUBLIC"]);
142
+ var ShareAccessEnum = zod.z.enum(["VIEW", "COMMENT", "DOWNLOAD", "EDIT"]);
143
+ var ShareTypeEnum = zod.z.enum(["PUBLIC_LINK", "EMAIL_INVITE", "GROUP_SHARE"]);
144
+ function message(error) {
145
+ return error instanceof Error ? error.message : String(error);
146
+ }
147
+ function pagination(limit, offset) {
148
+ return { limit: limit ?? 50, offset: offset ?? 0 };
149
+ }
150
+ function extensionOf(fileName) {
151
+ const dot = fileName.lastIndexOf(".");
152
+ return dot > 0 && dot < fileName.length - 1 ? fileName.slice(dot + 1).toLowerCase() : "";
61
153
  }
154
+ var fileSizeSchema = zod.z.number().int().positive().describe("File size in bytes");
62
155
  function registerFilesTools(server, ctx, track) {
63
- const featureNote = "Live alpha removed the `files` query family (workspace files are moving to a per-workspace service).";
64
- const alts = [
65
- "the next alpha release that re-exposes the files surface",
66
- "the SDK files API (which the MCP will mirror once it lands)"
67
- ];
68
- stubbedTool(
69
- server,
156
+ server.registerTool(
70
157
  track(mcpToolName(ctx.productName, "files_browse")),
71
- "Browse Folder",
72
- "Browse a workspace folder. Returns subfolders and paginated files.",
73
- featureNote,
74
- { folderId: zod.z.string().optional().describe("Folder ID (omit to browse root)") },
75
- alts
158
+ {
159
+ title: "Browse Folder",
160
+ description: "Browse a folder of the current workspace: a page of its subfolders and a page of its files. Omit folderId to browse the workspace root. Returns { folder, folders, foldersTotal, foldersHasMore, files, total, hasMore }.",
161
+ inputSchema: {
162
+ folderId: zod.z.string().optional().describe("Folder ID (omit for the root)"),
163
+ limit: zod.z.number().int().min(1).max(200).optional().describe("Files page size (default 50)"),
164
+ offset: zod.z.number().int().min(0).optional().describe("Files offset (default 0)"),
165
+ folderLimit: zod.z.number().int().min(1).max(200).optional().describe("Subfolders page size (default 50)"),
166
+ folderOffset: zod.z.number().int().min(0).optional().describe("Subfolders offset (default 0)")
167
+ }
168
+ },
169
+ async ({ folderId, limit, offset, folderLimit, folderOffset }) => {
170
+ try {
171
+ const [folder, folders, files] = await Promise.all([
172
+ folderId ? ctx.gql.workspace.request(
173
+ GET_FOLDER,
174
+ { id: folderId }
175
+ ) : Promise.resolve({ getFolder: null }),
176
+ ctx.gql.workspace.request(LIST_FOLDERS, {
177
+ filter: { parentFolderId: folderId ?? null },
178
+ pagination: pagination(folderLimit, folderOffset)
179
+ }),
180
+ ctx.gql.workspace.request(LIST_FILES, {
181
+ folderId: folderId ?? null,
182
+ pagination: pagination(limit, offset)
183
+ })
184
+ ]);
185
+ if (folderId && !folder.getFolder) return errorResult(`Folder ${folderId} not found`);
186
+ return jsonResult({
187
+ folder: folder.getFolder,
188
+ folders: folders.getFolders.folders,
189
+ foldersTotal: folders.getFolders.total,
190
+ foldersHasMore: folders.getFolders.hasMore,
191
+ files: files.getFiles.files,
192
+ total: files.getFiles.total,
193
+ hasMore: files.getFiles.hasMore
194
+ });
195
+ } catch (error) {
196
+ ctx.logger.error("files_browse failed", { error: String(error) });
197
+ return errorResult(`Failed to browse folder: ${message(error)}`);
198
+ }
199
+ }
76
200
  );
77
- stubbedTool(
78
- server,
201
+ server.registerTool(
79
202
  track(mcpToolName(ctx.productName, "files_list")),
80
- "List Files",
81
- "List files in a workspace, optionally scoped to a folder.",
82
- featureNote,
83
- { folderId: zod.z.string().optional().describe("Folder ID (omit to list workspace root)") },
84
- alts
203
+ {
204
+ title: "List Files",
205
+ description: "List files in the current workspace, optionally in one folder and filtered by MIME type, extension or starred. Returns { files, total, page, limit, hasMore }.",
206
+ inputSchema: {
207
+ folderId: zod.z.string().optional().describe("Folder ID (omit for the root)"),
208
+ mimeTypes: zod.z.array(zod.z.string()).optional().describe("Only these MIME types"),
209
+ extensions: zod.z.array(zod.z.string()).optional().describe("Only these extensions (no dot)"),
210
+ starred: zod.z.boolean().optional().describe("Only starred files"),
211
+ limit: zod.z.number().int().min(1).max(200).optional().describe("Page size (default 50)"),
212
+ offset: zod.z.number().int().min(0).optional().describe("Offset (default 0)")
213
+ }
214
+ },
215
+ async ({ folderId, mimeTypes, extensions, starred, limit, offset }) => {
216
+ try {
217
+ const filter = {};
218
+ if (mimeTypes !== void 0) filter.mimeTypes = mimeTypes;
219
+ if (extensions !== void 0) filter.extensions = extensions;
220
+ if (starred !== void 0) filter.starred = starred;
221
+ const data = await ctx.gql.workspace.request(LIST_FILES, {
222
+ folderId: folderId ?? null,
223
+ filter: Object.keys(filter).length ? filter : void 0,
224
+ pagination: pagination(limit, offset)
225
+ });
226
+ return jsonResult(data.getFiles);
227
+ } catch (error) {
228
+ ctx.logger.error("files_list failed", { error: String(error) });
229
+ return errorResult(`Failed to list files: ${message(error)}`);
230
+ }
231
+ }
85
232
  );
86
- stubbedTool(
87
- server,
233
+ server.registerTool(
88
234
  track(mcpToolName(ctx.productName, "files_get")),
89
- "Get File",
90
- "Get a single file by ID. Returns the file record or an error if not found.",
91
- featureNote,
92
- { id: zod.z.string().describe("File ID") },
93
- alts
235
+ {
236
+ title: "Get File",
237
+ description: "Get one file record (metadata, visibility, counters) by ID.",
238
+ inputSchema: { id: zod.z.string().describe("File ID") }
239
+ },
240
+ async ({ id }) => {
241
+ try {
242
+ const data = await ctx.gql.workspace.request(
243
+ GET_FILE,
244
+ { id }
245
+ );
246
+ if (!data.getFile) return errorResult(`File ${id} not found`);
247
+ return jsonResult(data.getFile);
248
+ } catch (error) {
249
+ ctx.logger.error("files_get failed", { error: String(error) });
250
+ return errorResult(`Failed to get file: ${message(error)}`);
251
+ }
252
+ }
94
253
  );
95
- stubbedTool(
96
- server,
254
+ server.registerTool(
97
255
  track(mcpToolName(ctx.productName, "files_download")),
98
- "Get File Download URL",
99
- "Resolve a server-signed presigned download URL for a file.",
100
- featureNote,
101
- { id: zod.z.string().describe("File ID") },
102
- alts
103
- );
104
- stubbedTool(
105
- server,
106
- track(mcpToolName(ctx.productName, "files_upload")),
107
- "Upload File",
108
- "Single-shot file upload mirroring the SDK files.upload contract (s3Bucket/s3Key/size pre-resolved). For raw-byte uploads from MCP callers, prefer files_upload_initiate + files_upload_complete which use presigned URLs.",
109
- featureNote,
110
- { name: zod.z.string().describe("Display filename including extension") },
111
- alts
256
+ {
257
+ title: "Get File Download URL",
258
+ description: "Return a short-lived presigned download URL for a file. The MCP server does not stream bytes; fetch the URL out of band. Returns { url, expiresIn }.",
259
+ inputSchema: {
260
+ id: zod.z.string().describe("File ID"),
261
+ expiresIn: zod.z.number().int().min(60).max(MAX_DOWNLOAD_URL_TTL_SECONDS).optional().describe("URL lifetime in seconds (60 to 604800; server default when omitted)")
262
+ }
263
+ },
264
+ async ({ id, expiresIn }) => {
265
+ try {
266
+ const data = await ctx.gql.workspace.request(
267
+ GET_FILE_DOWNLOAD_URL,
268
+ { id, expiresIn }
269
+ );
270
+ return jsonResult({ url: data.getFileDownloadUrl, expiresIn: expiresIn ?? null });
271
+ } catch (error) {
272
+ ctx.logger.error("files_download failed", { error: String(error) });
273
+ return errorResult(`Failed to resolve download URL: ${message(error)}`);
274
+ }
275
+ }
112
276
  );
113
- stubbedTool(
114
- server,
277
+ server.registerTool(
115
278
  track(mcpToolName(ctx.productName, "files_upload_initiate")),
116
- "Initiate File Upload",
117
- "Initiate a multipart upload session. Returns presigned URL(s) the caller must PUT bytes to, plus a sessionId to use with files_upload_complete.",
118
- featureNote,
119
- { fileName: zod.z.string().describe("File name including extension") },
120
- alts
279
+ {
280
+ title: "Initiate File Upload",
281
+ description: "Start an upload session. Returns the session (id, uploadType, partSize, totalParts) and either one presigned uploadUrl or, for multipart uploads, presignedUrls: PUT byte range [(partNumber-1)*partSize, partNumber*partSize) to each part URL. Then call files_upload_complete with the session id.",
282
+ inputSchema: {
283
+ fileName: zod.z.string().min(1).describe("File name including extension"),
284
+ fileSize: fileSizeSchema,
285
+ mimeType: zod.z.string().optional().describe("MIME type (default application/octet-stream)"),
286
+ extension: zod.z.string().optional().describe("Extension without the dot (derived from fileName when omitted)"),
287
+ sha256Hash: zod.z.string().optional().describe("Hex SHA-256 of the contents"),
288
+ folderId: zod.z.string().optional().describe("Target folder ID"),
289
+ visibility: VisibilityEnum.optional().describe("Visibility (default WORKSPACE)")
290
+ }
291
+ },
292
+ async ({ fileName, fileSize, mimeType, extension, sha256Hash, folderId, visibility }) => {
293
+ try {
294
+ const input = {
295
+ fileName,
296
+ fileSize: String(fileSize),
297
+ mimeType: mimeType ?? "application/octet-stream",
298
+ extension: extension ?? extensionOf(fileName),
299
+ visibility: visibility ?? "WORKSPACE"
300
+ };
301
+ if (sha256Hash !== void 0) input.sha256Hash = sha256Hash;
302
+ if (folderId !== void 0) input.folderId = folderId;
303
+ const data = await ctx.gql.workspace.request(
304
+ INITIATE_UPLOAD,
305
+ { input }
306
+ );
307
+ return jsonResult(data.initiateUpload);
308
+ } catch (error) {
309
+ ctx.logger.error("files_upload_initiate failed", { error: String(error) });
310
+ return errorResult(`Failed to initiate upload: ${message(error)}`);
311
+ }
312
+ }
121
313
  );
122
- stubbedTool(
123
- server,
314
+ server.registerTool(
124
315
  track(mcpToolName(ctx.productName, "files_upload_complete")),
125
- "Complete File Upload",
126
- "Complete an in-flight upload session previously initiated by files_upload_initiate.",
127
- featureNote,
128
- { sessionId: zod.z.string().describe("Session ID from files_upload_initiate") },
129
- alts
316
+ {
317
+ title: "Complete File Upload",
318
+ description: "Finish an upload session after the bytes were PUT to the presigned URL. fileSize must match the size passed to files_upload_initiate.",
319
+ inputSchema: {
320
+ sessionId: zod.z.string().describe("Session ID from files_upload_initiate"),
321
+ fileSize: fileSizeSchema,
322
+ sha256Hash: zod.z.string().optional().describe("Hex SHA-256 of the contents"),
323
+ folderId: zod.z.string().optional().describe("Target folder ID (overrides initiate)"),
324
+ description: zod.z.string().optional().describe("File description")
325
+ }
326
+ },
327
+ async ({ sessionId, fileSize, sha256Hash, folderId, description }) => {
328
+ try {
329
+ const input = { sessionId, fileSize: String(fileSize) };
330
+ if (sha256Hash !== void 0) input.sha256Hash = sha256Hash;
331
+ if (folderId !== void 0) input.folderId = folderId;
332
+ if (description !== void 0) input.description = description;
333
+ const data = await ctx.gql.workspace.request(
334
+ COMPLETE_UPLOAD,
335
+ { input }
336
+ );
337
+ return jsonResult(data.completeUpload);
338
+ } catch (error) {
339
+ ctx.logger.error("files_upload_complete failed", { error: String(error) });
340
+ return errorResult(`Failed to complete upload: ${message(error)}`);
341
+ }
342
+ }
130
343
  );
131
- stubbedTool(
132
- server,
344
+ server.registerTool(
345
+ track(mcpToolName(ctx.productName, "files_upload")),
346
+ {
347
+ title: "Register Uploaded File",
348
+ description: "Register an object that already exists in the workspace bucket as a file (mirrors the SDK files.upload contract). For new bytes use files_upload_initiate + files_upload_complete.",
349
+ inputSchema: {
350
+ name: zod.z.string().min(1).describe("Display file name including extension"),
351
+ mimeType: zod.z.string().describe("MIME type"),
352
+ extension: zod.z.string().describe("Extension without the dot"),
353
+ size: fileSizeSchema,
354
+ s3Bucket: zod.z.string().describe("Bucket holding the object"),
355
+ s3Key: zod.z.string().describe("Object key"),
356
+ description: zod.z.string().optional().describe("File description"),
357
+ folderId: zod.z.string().optional().describe("Target folder ID"),
358
+ visibility: VisibilityEnum.optional().describe("Visibility (default WORKSPACE)")
359
+ }
360
+ },
361
+ async ({
362
+ name,
363
+ mimeType,
364
+ extension,
365
+ size,
366
+ s3Bucket,
367
+ s3Key,
368
+ description,
369
+ folderId,
370
+ visibility
371
+ }) => {
372
+ try {
373
+ const input = {
374
+ name,
375
+ mimeType,
376
+ extension,
377
+ size: String(size),
378
+ s3Bucket,
379
+ s3Key
380
+ };
381
+ if (description !== void 0) input.description = description;
382
+ if (folderId !== void 0) input.folderId = folderId;
383
+ if (visibility !== void 0) input.visibility = visibility;
384
+ const data = await ctx.gql.workspace.request(UPLOAD_FILE, {
385
+ input
386
+ });
387
+ return jsonResult(data.uploadFile);
388
+ } catch (error) {
389
+ ctx.logger.error("files_upload failed", { error: String(error) });
390
+ return errorResult(`Failed to register file: ${message(error)}`);
391
+ }
392
+ }
393
+ );
394
+ const createShare = async (input, tool) => {
395
+ try {
396
+ const data = await ctx.gql.workspace.request(CREATE_SHARE, {
397
+ input
398
+ });
399
+ return jsonResult(data.createShare);
400
+ } catch (error) {
401
+ ctx.logger.error(`${tool} failed`, { error: String(error) });
402
+ return errorResult(`Failed to share file: ${message(error)}`);
403
+ }
404
+ };
405
+ server.registerTool(
133
406
  track(mcpToolName(ctx.productName, "files_share")),
134
- "Share File",
135
- "Create a share for a file (mirrors SDK files.share).",
136
- featureNote,
137
- { fileId: zod.z.string().describe("File ID to share") },
138
- alts
407
+ {
408
+ title: "Share File",
409
+ description: "Share a file: PUBLIC_LINK (anyone with the link), EMAIL_INVITE (one email) or GROUP_SHARE (listed user IDs).",
410
+ inputSchema: {
411
+ fileId: zod.z.string().describe("File ID"),
412
+ shareType: ShareTypeEnum.describe("How the file is shared"),
413
+ accessLevel: ShareAccessEnum.describe("What the share allows"),
414
+ expiresAt: zod.z.string().optional().describe("Expiry (ISO-8601)"),
415
+ password: zod.z.string().optional().describe("Password that gates the share"),
416
+ maxDownloads: zod.z.number().int().positive().optional().describe("Download limit"),
417
+ invitedEmail: zod.z.string().optional().describe("Email for EMAIL_INVITE"),
418
+ invitedUserIds: zod.z.array(zod.z.string()).optional().describe("User IDs for GROUP_SHARE")
419
+ }
420
+ },
421
+ async (args) => {
422
+ const input = {};
423
+ for (const [key, value] of Object.entries(args)) if (value !== void 0) input[key] = value;
424
+ if (args.shareType === "EMAIL_INVITE" && !args.invitedEmail) {
425
+ return errorResult("EMAIL_INVITE shares need invitedEmail.");
426
+ }
427
+ if (args.shareType === "GROUP_SHARE" && !args.invitedUserIds?.length) {
428
+ return errorResult("GROUP_SHARE shares need at least one invitedUserIds entry.");
429
+ }
430
+ return createShare(input, "files_share");
431
+ }
139
432
  );
140
- stubbedTool(
141
- server,
433
+ server.registerTool(
142
434
  track(mcpToolName(ctx.productName, "files_share_create")),
143
- "Create File Share",
144
- "Create a shareable link for a file with optional access controls.",
145
- featureNote,
146
- { fileId: zod.z.string().describe("File ID to share") },
147
- alts
435
+ {
436
+ title: "Create File Share Link",
437
+ description: "Create a public share link for a file (DOWNLOAD access unless stated).",
438
+ inputSchema: {
439
+ fileId: zod.z.string().describe("File ID"),
440
+ access: ShareAccessEnum.optional().describe("Access level (default DOWNLOAD)"),
441
+ expiresAt: zod.z.string().optional().describe("Expiry (ISO-8601)"),
442
+ password: zod.z.string().optional().describe("Password that gates the link"),
443
+ maxDownloads: zod.z.number().int().positive().optional().describe("Download limit")
444
+ }
445
+ },
446
+ async ({ fileId, access, expiresAt, password, maxDownloads }) => {
447
+ const input = {
448
+ fileId,
449
+ shareType: "PUBLIC_LINK",
450
+ accessLevel: access ?? "DOWNLOAD"
451
+ };
452
+ if (expiresAt !== void 0) input.expiresAt = expiresAt;
453
+ if (password !== void 0) input.password = password;
454
+ if (maxDownloads !== void 0) input.maxDownloads = maxDownloads;
455
+ return createShare(input, "files_share_create");
456
+ }
148
457
  );
149
- stubbedTool(
150
- server,
458
+ const revokeShare = async (id, tool) => {
459
+ try {
460
+ const data = await ctx.gql.workspace.request(REVOKE_SHARE, {
461
+ id
462
+ });
463
+ return jsonResult(data.revokeShare);
464
+ } catch (error) {
465
+ ctx.logger.error(`${tool} failed`, { error: String(error) });
466
+ return errorResult(`Failed to revoke share: ${message(error)}`);
467
+ }
468
+ };
469
+ server.registerTool(
151
470
  track(mcpToolName(ctx.productName, "files_share_revoke")),
152
- "Revoke File Share",
153
- "Revoke a previously created file share by ID.",
154
- featureNote,
155
- { id: zod.z.string().describe("Share ID to revoke") },
156
- alts
471
+ {
472
+ title: "Revoke File Share",
473
+ description: "Revoke a file share by its share ID.",
474
+ inputSchema: { id: zod.z.string().describe("Share ID") }
475
+ },
476
+ async ({ id }) => revokeShare(id, "files_share_revoke")
157
477
  );
158
- stubbedTool(
159
- server,
478
+ server.registerTool(
160
479
  track(mcpToolName(ctx.productName, "files_revoke")),
161
- "Revoke File Share",
162
- "Revoke an existing file share by ID (mirrors SDK files.shareApi.revoke).",
163
- featureNote,
164
- { id: zod.z.string().describe("Share ID") },
165
- alts
480
+ {
481
+ title: "Revoke File Share (SDK alias)",
482
+ description: "Alias of files_share_revoke that mirrors the SDK files.revoke name.",
483
+ inputSchema: { id: zod.z.string().describe("Share ID") }
484
+ },
485
+ async ({ id }) => revokeShare(id, "files_revoke")
166
486
  );
167
487
  }
168
488