@mcp-z/mcp-drive 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,6 +8,7 @@ Google Drive MCP server for searching files, browsing folders, and managing Driv
8
8
  - Search files and folders
9
9
  - Browse folder contents and paths
10
10
  - Move, create, and trash Drive items
11
+ - Upload files from a local path or URL
11
12
 
12
13
  ## Transports
13
14
 
@@ -172,11 +173,12 @@ mcp-z call drive files-search '{"query":"name contains \\\"report\\\""}'
172
173
 
173
174
  1. file-move
174
175
  2. file-move-to-trash
175
- 3. files-search
176
- 4. folder-contents
177
- 5. folder-create
178
- 6. folder-path
179
- 7. folder-search
176
+ 3. file-upload
177
+ 4. files-search
178
+ 5. folder-contents
179
+ 6. folder-create
180
+ 7. folder-path
181
+ 8. folder-search
180
182
 
181
183
  ## Resources
182
184
 
@@ -0,0 +1,35 @@
1
+ /** Streaming file source utilities for memory-efficient uploads (no temp files) */
2
+ import { Readable } from 'stream';
3
+ /** Resolved source for an upload URI: a readable stream plus naming/MIME hints */
4
+ export interface FileSource {
5
+ /** Binary read stream of the file content */
6
+ stream: Readable;
7
+ /** Best-effort file name (used as default Drive name) */
8
+ fileName: string;
9
+ /** MIME type from the Content-Type header (http/https sources only) */
10
+ contentType?: string;
11
+ /** File size in bytes when known (file:// via stat, http/https via Content-Length) */
12
+ size?: number;
13
+ }
14
+ /** Guess MIME type from file name extension (application/octet-stream fallback) */
15
+ export declare function guessMimeType(fileName: string): string;
16
+ /**
17
+ * Get readable stream and metadata from a file URI
18
+ *
19
+ * Memory efficiency:
20
+ * - file:// URIs stream directly from disk
21
+ * - http:// URIs stream directly from response (no temp files!)
22
+ *
23
+ * Unlike mcp-sheets' getCsvReadStream, this streams binary content
24
+ * (no text encoding) so arbitrary file types can be uploaded.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const source = await getFileReadStream('file:///path/to/report.pdf');
29
+ * await drive.files.create({
30
+ * requestBody: { name: source.fileName },
31
+ * media: { mimeType: guessMimeType(source.fileName), body: source.stream },
32
+ * });
33
+ * ```
34
+ */
35
+ export declare function getFileReadStream(fileUri: string): Promise<FileSource>;
@@ -0,0 +1,35 @@
1
+ /** Streaming file source utilities for memory-efficient uploads (no temp files) */
2
+ import { Readable } from 'stream';
3
+ /** Resolved source for an upload URI: a readable stream plus naming/MIME hints */
4
+ export interface FileSource {
5
+ /** Binary read stream of the file content */
6
+ stream: Readable;
7
+ /** Best-effort file name (used as default Drive name) */
8
+ fileName: string;
9
+ /** MIME type from the Content-Type header (http/https sources only) */
10
+ contentType?: string;
11
+ /** File size in bytes when known (file:// via stat, http/https via Content-Length) */
12
+ size?: number;
13
+ }
14
+ /** Guess MIME type from file name extension (application/octet-stream fallback) */
15
+ export declare function guessMimeType(fileName: string): string;
16
+ /**
17
+ * Get readable stream and metadata from a file URI
18
+ *
19
+ * Memory efficiency:
20
+ * - file:// URIs stream directly from disk
21
+ * - http:// URIs stream directly from response (no temp files!)
22
+ *
23
+ * Unlike mcp-sheets' getCsvReadStream, this streams binary content
24
+ * (no text encoding) so arbitrary file types can be uploaded.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const source = await getFileReadStream('file:///path/to/report.pdf');
29
+ * await drive.files.create({
30
+ * requestBody: { name: source.fileName },
31
+ * media: { mimeType: guessMimeType(source.fileName), body: source.stream },
32
+ * });
33
+ * ```
34
+ */
35
+ export declare function getFileReadStream(fileUri: string): Promise<FileSource>;
@@ -0,0 +1,289 @@
1
+ /** Streaming file source utilities for memory-efficient uploads (no temp files) */ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get getFileReadStream () {
13
+ return getFileReadStream;
14
+ },
15
+ get guessMimeType () {
16
+ return guessMimeType;
17
+ }
18
+ });
19
+ var _fs = require("fs");
20
+ var _promises = require("fs/promises");
21
+ var _path = require("path");
22
+ var _stream = require("stream");
23
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
24
+ try {
25
+ var info = gen[key](arg);
26
+ var value = info.value;
27
+ } catch (error) {
28
+ reject(error);
29
+ return;
30
+ }
31
+ if (info.done) resolve(value);
32
+ else Promise.resolve(value).then(_next, _throw);
33
+ }
34
+ function _async_to_generator(fn) {
35
+ return function() {
36
+ var self = this, args = arguments;
37
+ return new Promise(function(resolve, reject) {
38
+ var gen = fn.apply(self, args);
39
+ function _next(value) {
40
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
41
+ }
42
+ function _throw(err) {
43
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
44
+ }
45
+ _next(undefined);
46
+ });
47
+ };
48
+ }
49
+ function _define_property(obj, key, value) {
50
+ if (key in obj) {
51
+ Object.defineProperty(obj, key, {
52
+ value: value,
53
+ enumerable: true,
54
+ configurable: true,
55
+ writable: true
56
+ });
57
+ } else obj[key] = value;
58
+ return obj;
59
+ }
60
+ function _object_spread(target) {
61
+ for(var i = 1; i < arguments.length; i++){
62
+ var source = arguments[i] != null ? arguments[i] : {};
63
+ var ownKeys = Object.keys(source);
64
+ if (typeof Object.getOwnPropertySymbols === "function") {
65
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
66
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
67
+ }));
68
+ }
69
+ ownKeys.forEach(function(key) {
70
+ _define_property(target, key, source[key]);
71
+ });
72
+ }
73
+ return target;
74
+ }
75
+ function _ts_generator(thisArg, body) {
76
+ var f, y, t, _ = {
77
+ label: 0,
78
+ sent: function() {
79
+ if (t[0] & 1) throw t[1];
80
+ return t[1];
81
+ },
82
+ trys: [],
83
+ ops: []
84
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
85
+ return d(g, "next", {
86
+ value: verb(0)
87
+ }), d(g, "throw", {
88
+ value: verb(1)
89
+ }), d(g, "return", {
90
+ value: verb(2)
91
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
92
+ value: function() {
93
+ return this;
94
+ }
95
+ }), g;
96
+ function verb(n) {
97
+ return function(v) {
98
+ return step([
99
+ n,
100
+ v
101
+ ]);
102
+ };
103
+ }
104
+ function step(op) {
105
+ if (f) throw new TypeError("Generator is already executing.");
106
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
107
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
108
+ if (y = 0, t) op = [
109
+ op[0] & 2,
110
+ t.value
111
+ ];
112
+ switch(op[0]){
113
+ case 0:
114
+ case 1:
115
+ t = op;
116
+ break;
117
+ case 4:
118
+ _.label++;
119
+ return {
120
+ value: op[1],
121
+ done: false
122
+ };
123
+ case 5:
124
+ _.label++;
125
+ y = op[1];
126
+ op = [
127
+ 0
128
+ ];
129
+ continue;
130
+ case 7:
131
+ op = _.ops.pop();
132
+ _.trys.pop();
133
+ continue;
134
+ default:
135
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
136
+ _ = 0;
137
+ continue;
138
+ }
139
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
140
+ _.label = op[1];
141
+ break;
142
+ }
143
+ if (op[0] === 6 && _.label < t[1]) {
144
+ _.label = t[1];
145
+ t = op;
146
+ break;
147
+ }
148
+ if (t && _.label < t[2]) {
149
+ _.label = t[2];
150
+ _.ops.push(op);
151
+ break;
152
+ }
153
+ if (t[2]) _.ops.pop();
154
+ _.trys.pop();
155
+ continue;
156
+ }
157
+ op = body.call(thisArg, _);
158
+ } catch (e) {
159
+ op = [
160
+ 6,
161
+ e
162
+ ];
163
+ y = 0;
164
+ } finally{
165
+ f = t = 0;
166
+ }
167
+ if (op[0] & 5) throw op[1];
168
+ return {
169
+ value: op[0] ? op[1] : void 0,
170
+ done: true
171
+ };
172
+ }
173
+ }
174
+ /** Common extension → MIME map; falls back to application/octet-stream */ var MIME_BY_EXTENSION = {
175
+ '.csv': 'text/csv',
176
+ '.doc': 'application/msword',
177
+ '.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
178
+ '.gif': 'image/gif',
179
+ '.gz': 'application/gzip',
180
+ '.html': 'text/html',
181
+ '.jpeg': 'image/jpeg',
182
+ '.jpg': 'image/jpeg',
183
+ '.json': 'application/json',
184
+ '.md': 'text/markdown',
185
+ '.mp3': 'audio/mpeg',
186
+ '.mp4': 'video/mp4',
187
+ '.pdf': 'application/pdf',
188
+ '.png': 'image/png',
189
+ '.ppt': 'application/vnd.ms-powerpoint',
190
+ '.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
191
+ '.rtf': 'application/rtf',
192
+ '.svg': 'image/svg+xml',
193
+ '.tar': 'application/x-tar',
194
+ '.txt': 'text/plain',
195
+ '.webp': 'image/webp',
196
+ '.woff': 'font/woff',
197
+ '.woff2': 'font/woff2',
198
+ '.xls': 'application/vnd.ms-excel',
199
+ '.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
200
+ '.xml': 'application/xml',
201
+ '.zip': 'application/zip'
202
+ };
203
+ function guessMimeType(fileName) {
204
+ var _MIME_BY_EXTENSION_extname_toLowerCase;
205
+ return (_MIME_BY_EXTENSION_extname_toLowerCase = MIME_BY_EXTENSION[(0, _path.extname)(fileName).toLowerCase()]) !== null && _MIME_BY_EXTENSION_extname_toLowerCase !== void 0 ? _MIME_BY_EXTENSION_extname_toLowerCase : 'application/octet-stream';
206
+ }
207
+ function getFileReadStream(fileUri) {
208
+ return _async_to_generator(function() {
209
+ var rawPath, filePath, fileSize, _response_headers_get_split_, _response_headers_get, response, stream, contentType, contentLength;
210
+ return _ts_generator(this, function(_state) {
211
+ switch(_state.label){
212
+ case 0:
213
+ if (!fileUri.startsWith('file://')) return [
214
+ 3,
215
+ 2
216
+ ];
217
+ // Local file - stream directly from disk
218
+ rawPath = fileUri.slice('file://'.length);
219
+ filePath = rawPath.startsWith('/') ? rawPath : (0, _path.resolve)(rawPath);
220
+ return [
221
+ 4,
222
+ (0, _promises.stat)(filePath)
223
+ ];
224
+ case 1:
225
+ fileSize = _state.sent().size;
226
+ return [
227
+ 2,
228
+ {
229
+ stream: (0, _fs.createReadStream)(filePath),
230
+ fileName: (0, _path.basename)(filePath),
231
+ size: fileSize
232
+ }
233
+ ];
234
+ case 2:
235
+ if (!(fileUri.startsWith('http://') || fileUri.startsWith('https://'))) return [
236
+ 3,
237
+ 4
238
+ ];
239
+ return [
240
+ 4,
241
+ fetch(fileUri)
242
+ ];
243
+ case 3:
244
+ response = _state.sent();
245
+ if (!response.ok) {
246
+ throw new Error("Failed to fetch file from ".concat(fileUri, ": ").concat(response.statusText));
247
+ }
248
+ if (!response.body) {
249
+ throw new Error("No response body from ".concat(fileUri));
250
+ }
251
+ // Convert web stream to Node.js stream
252
+ // response.body is ReadableStream<Uint8Array> from fetch API
253
+ // Cast to Node.js ReadableStream type for compatibility with Readable.fromWeb
254
+ stream = _stream.Readable.fromWeb(response.body);
255
+ contentType = (_response_headers_get = response.headers.get('content-type')) === null || _response_headers_get === void 0 ? void 0 : (_response_headers_get_split_ = _response_headers_get.split(';')[0]) === null || _response_headers_get_split_ === void 0 ? void 0 : _response_headers_get_split_.trim();
256
+ contentLength = response.headers.get('content-length');
257
+ return [
258
+ 2,
259
+ _object_spread({
260
+ stream: stream,
261
+ fileName: getRemoteFileName(response.headers.get('content-disposition'), fileUri)
262
+ }, contentType && {
263
+ contentType: contentType
264
+ }, contentLength && {
265
+ size: Number.parseInt(contentLength, 10)
266
+ })
267
+ ];
268
+ case 4:
269
+ throw new Error("Invalid file URI: ".concat(fileUri, ". Must start with file://, http://, or https://"));
270
+ }
271
+ });
272
+ })();
273
+ }
274
+ /** Best-effort file name for a remote source: Content-Disposition, then URL path */ function getRemoteFileName(contentDisposition, fileUri) {
275
+ if (contentDisposition) {
276
+ var _ref;
277
+ var match = /filename="([^"]+)"|filename=([^;]+)/i.exec(contentDisposition);
278
+ var fromHeader = (_ref = match === null || match === void 0 ? void 0 : match[1]) !== null && _ref !== void 0 ? _ref : match === null || match === void 0 ? void 0 : match[2];
279
+ if (fromHeader) {
280
+ return fromHeader.trim();
281
+ }
282
+ }
283
+ try {
284
+ return decodeURIComponent((0, _path.basename)(new URL(fileUri).pathname)) || 'upload.bin';
285
+ } catch (unused) {
286
+ return 'upload.bin';
287
+ }
288
+ }
289
+ /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/mcp-drive/src/lib/file-streaming.ts"],"sourcesContent":["/** Streaming file source utilities for memory-efficient uploads (no temp files) */\n\nimport { createReadStream } from 'fs';\nimport { stat } from 'fs/promises';\nimport { basename, extname, resolve } from 'path';\nimport { Readable } from 'stream';\nimport type { ReadableStream as NodeReadableStream } from 'stream/web';\n\n/** Resolved source for an upload URI: a readable stream plus naming/MIME hints */\nexport interface FileSource {\n /** Binary read stream of the file content */\n stream: Readable;\n /** Best-effort file name (used as default Drive name) */\n fileName: string;\n /** MIME type from the Content-Type header (http/https sources only) */\n contentType?: string;\n /** File size in bytes when known (file:// via stat, http/https via Content-Length) */\n size?: number;\n}\n\n/** Common extension → MIME map; falls back to application/octet-stream */\nconst MIME_BY_EXTENSION: Record<string, string> = {\n '.csv': 'text/csv',\n '.doc': 'application/msword',\n '.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n '.gif': 'image/gif',\n '.gz': 'application/gzip',\n '.html': 'text/html',\n '.jpeg': 'image/jpeg',\n '.jpg': 'image/jpeg',\n '.json': 'application/json',\n '.md': 'text/markdown',\n '.mp3': 'audio/mpeg',\n '.mp4': 'video/mp4',\n '.pdf': 'application/pdf',\n '.png': 'image/png',\n '.ppt': 'application/vnd.ms-powerpoint',\n '.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n '.rtf': 'application/rtf',\n '.svg': 'image/svg+xml',\n '.tar': 'application/x-tar',\n '.txt': 'text/plain',\n '.webp': 'image/webp',\n '.woff': 'font/woff',\n '.woff2': 'font/woff2',\n '.xls': 'application/vnd.ms-excel',\n '.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n '.xml': 'application/xml',\n '.zip': 'application/zip',\n};\n\n/** Guess MIME type from file name extension (application/octet-stream fallback) */\nexport function guessMimeType(fileName: string): string {\n return MIME_BY_EXTENSION[extname(fileName).toLowerCase()] ?? 'application/octet-stream';\n}\n\n/**\n * Get readable stream and metadata from a file URI\n *\n * Memory efficiency:\n * - file:// URIs stream directly from disk\n * - http:// URIs stream directly from response (no temp files!)\n *\n * Unlike mcp-sheets' getCsvReadStream, this streams binary content\n * (no text encoding) so arbitrary file types can be uploaded.\n *\n * @example\n * ```ts\n * const source = await getFileReadStream('file:///path/to/report.pdf');\n * await drive.files.create({\n * requestBody: { name: source.fileName },\n * media: { mimeType: guessMimeType(source.fileName), body: source.stream },\n * });\n * ```\n */\nexport async function getFileReadStream(fileUri: string): Promise<FileSource> {\n if (fileUri.startsWith('file://')) {\n // Local file - stream directly from disk\n const rawPath = fileUri.slice('file://'.length);\n const filePath = rawPath.startsWith('/') ? rawPath : resolve(rawPath);\n const fileSize = (await stat(filePath)).size;\n return {\n stream: createReadStream(filePath),\n fileName: basename(filePath),\n size: fileSize,\n };\n }\n\n if (fileUri.startsWith('http://') || fileUri.startsWith('https://')) {\n // Remote file - stream directly from fetch response\n const response = await fetch(fileUri);\n if (!response.ok) {\n throw new Error(`Failed to fetch file from ${fileUri}: ${response.statusText}`);\n }\n\n if (!response.body) {\n throw new Error(`No response body from ${fileUri}`);\n }\n\n // Convert web stream to Node.js stream\n // response.body is ReadableStream<Uint8Array> from fetch API\n // Cast to Node.js ReadableStream type for compatibility with Readable.fromWeb\n const stream = Readable.fromWeb(response.body as unknown as NodeReadableStream<Uint8Array>);\n const contentType = response.headers.get('content-type')?.split(';')[0]?.trim();\n const contentLength = response.headers.get('content-length');\n\n return {\n stream,\n fileName: getRemoteFileName(response.headers.get('content-disposition'), fileUri),\n ...(contentType && { contentType }),\n ...(contentLength && { size: Number.parseInt(contentLength, 10) }),\n };\n }\n\n throw new Error(`Invalid file URI: ${fileUri}. Must start with file://, http://, or https://`);\n}\n\n/** Best-effort file name for a remote source: Content-Disposition, then URL path */\nfunction getRemoteFileName(contentDisposition: string | null, fileUri: string): string {\n if (contentDisposition) {\n const match = /filename=\"([^\"]+)\"|filename=([^;]+)/i.exec(contentDisposition);\n const fromHeader = match?.[1] ?? match?.[2];\n if (fromHeader) {\n return fromHeader.trim();\n }\n }\n\n try {\n return decodeURIComponent(basename(new URL(fileUri).pathname)) || 'upload.bin';\n } catch {\n return 'upload.bin';\n }\n}\n"],"names":["getFileReadStream","guessMimeType","MIME_BY_EXTENSION","fileName","extname","toLowerCase","fileUri","rawPath","filePath","fileSize","response","stream","contentType","contentLength","startsWith","slice","length","resolve","stat","size","createReadStream","basename","fetch","ok","Error","statusText","body","Readable","fromWeb","headers","get","split","trim","getRemoteFileName","Number","parseInt","contentDisposition","match","exec","fromHeader","decodeURIComponent","URL","pathname"],"mappings":"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"}
@@ -0,0 +1,69 @@
1
+ import type { EnrichedExtra } from '@mcp-z/oauth-google';
2
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
3
+ import { z } from 'zod';
4
+ declare const inputSchema: z.ZodObject<{
5
+ sourceUri: z.ZodString;
6
+ name: z.ZodOptional<z.ZodString>;
7
+ mimeType: z.ZodOptional<z.ZodString>;
8
+ parentId: z.ZodOptional<z.ZodString>;
9
+ description: z.ZodOptional<z.ZodString>;
10
+ }, z.core.$strip>;
11
+ declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
12
+ type: z.ZodLiteral<"success">;
13
+ operationSummary: z.ZodString;
14
+ itemsProcessed: z.ZodNumber;
15
+ itemsChanged: z.ZodNumber;
16
+ completedAt: z.ZodString;
17
+ id: z.ZodString;
18
+ name: z.ZodString;
19
+ mimeType: z.ZodString;
20
+ size: z.ZodString;
21
+ webViewLink: z.ZodString;
22
+ parentId: z.ZodOptional<z.ZodString>;
23
+ parentName: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strip>, z.ZodObject<{
25
+ type: z.ZodLiteral<"auth_required">;
26
+ provider: z.ZodString;
27
+ message: z.ZodString;
28
+ url: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strip>], "type">;
30
+ export type Input = z.infer<typeof inputSchema>;
31
+ export type Output = z.infer<typeof outputSchema>;
32
+ declare function handler({ sourceUri, name, mimeType, parentId, description }: Input, extra: EnrichedExtra): Promise<CallToolResult>;
33
+ export default function createTool(): {
34
+ name: "file-upload";
35
+ config: {
36
+ readonly title: "Upload File";
37
+ readonly description: "Upload a file to Google Drive from a file:// or http(s):// URI. Content is streamed from the source (no temp files) in a single multipart request. Returns file ID for use in other operations.";
38
+ readonly inputSchema: z.ZodObject<{
39
+ sourceUri: z.ZodString;
40
+ name: z.ZodOptional<z.ZodString>;
41
+ mimeType: z.ZodOptional<z.ZodString>;
42
+ parentId: z.ZodOptional<z.ZodString>;
43
+ description: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$strip>;
45
+ readonly outputSchema: z.ZodObject<{
46
+ result: z.ZodDiscriminatedUnion<[z.ZodObject<{
47
+ type: z.ZodLiteral<"success">;
48
+ operationSummary: z.ZodString;
49
+ itemsProcessed: z.ZodNumber;
50
+ itemsChanged: z.ZodNumber;
51
+ completedAt: z.ZodString;
52
+ id: z.ZodString;
53
+ name: z.ZodString;
54
+ mimeType: z.ZodString;
55
+ size: z.ZodString;
56
+ webViewLink: z.ZodString;
57
+ parentId: z.ZodOptional<z.ZodString>;
58
+ parentName: z.ZodOptional<z.ZodString>;
59
+ }, z.core.$strip>, z.ZodObject<{
60
+ type: z.ZodLiteral<"auth_required">;
61
+ provider: z.ZodString;
62
+ message: z.ZodString;
63
+ url: z.ZodOptional<z.ZodString>;
64
+ }, z.core.$strip>], "type">;
65
+ }, z.core.$strip>;
66
+ };
67
+ handler: typeof handler;
68
+ };
69
+ export {};
@@ -0,0 +1,69 @@
1
+ import type { EnrichedExtra } from '@mcp-z/oauth-google';
2
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
3
+ import { z } from 'zod';
4
+ declare const inputSchema: z.ZodObject<{
5
+ sourceUri: z.ZodString;
6
+ name: z.ZodOptional<z.ZodString>;
7
+ mimeType: z.ZodOptional<z.ZodString>;
8
+ parentId: z.ZodOptional<z.ZodString>;
9
+ description: z.ZodOptional<z.ZodString>;
10
+ }, z.core.$strip>;
11
+ declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
12
+ type: z.ZodLiteral<"success">;
13
+ operationSummary: z.ZodString;
14
+ itemsProcessed: z.ZodNumber;
15
+ itemsChanged: z.ZodNumber;
16
+ completedAt: z.ZodString;
17
+ id: z.ZodString;
18
+ name: z.ZodString;
19
+ mimeType: z.ZodString;
20
+ size: z.ZodString;
21
+ webViewLink: z.ZodString;
22
+ parentId: z.ZodOptional<z.ZodString>;
23
+ parentName: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strip>, z.ZodObject<{
25
+ type: z.ZodLiteral<"auth_required">;
26
+ provider: z.ZodString;
27
+ message: z.ZodString;
28
+ url: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strip>], "type">;
30
+ export type Input = z.infer<typeof inputSchema>;
31
+ export type Output = z.infer<typeof outputSchema>;
32
+ declare function handler({ sourceUri, name, mimeType, parentId, description }: Input, extra: EnrichedExtra): Promise<CallToolResult>;
33
+ export default function createTool(): {
34
+ name: "file-upload";
35
+ config: {
36
+ readonly title: "Upload File";
37
+ readonly description: "Upload a file to Google Drive from a file:// or http(s):// URI. Content is streamed from the source (no temp files) in a single multipart request. Returns file ID for use in other operations.";
38
+ readonly inputSchema: z.ZodObject<{
39
+ sourceUri: z.ZodString;
40
+ name: z.ZodOptional<z.ZodString>;
41
+ mimeType: z.ZodOptional<z.ZodString>;
42
+ parentId: z.ZodOptional<z.ZodString>;
43
+ description: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$strip>;
45
+ readonly outputSchema: z.ZodObject<{
46
+ result: z.ZodDiscriminatedUnion<[z.ZodObject<{
47
+ type: z.ZodLiteral<"success">;
48
+ operationSummary: z.ZodString;
49
+ itemsProcessed: z.ZodNumber;
50
+ itemsChanged: z.ZodNumber;
51
+ completedAt: z.ZodString;
52
+ id: z.ZodString;
53
+ name: z.ZodString;
54
+ mimeType: z.ZodString;
55
+ size: z.ZodString;
56
+ webViewLink: z.ZodString;
57
+ parentId: z.ZodOptional<z.ZodString>;
58
+ parentName: z.ZodOptional<z.ZodString>;
59
+ }, z.core.$strip>, z.ZodObject<{
60
+ type: z.ZodLiteral<"auth_required">;
61
+ provider: z.ZodString;
62
+ message: z.ZodString;
63
+ url: z.ZodOptional<z.ZodString>;
64
+ }, z.core.$strip>], "type">;
65
+ }, z.core.$strip>;
66
+ };
67
+ handler: typeof handler;
68
+ };
69
+ export {};