@mcp-z/mcp-drive 1.0.8 → 1.0.10

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/dist/cjs/constants.js.map +1 -1
  2. package/dist/cjs/index.js +10 -24
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/lib/create-store.js +2 -5
  5. package/dist/cjs/lib/create-store.js.map +1 -1
  6. package/dist/cjs/lib/file-streaming.d.cts +35 -0
  7. package/dist/cjs/lib/file-streaming.d.ts +35 -0
  8. package/dist/cjs/lib/file-streaming.js +289 -0
  9. package/dist/cjs/lib/file-streaming.js.map +1 -0
  10. package/dist/cjs/lib/query-builder.js.map +1 -1
  11. package/dist/cjs/mcp/index.js +8 -19
  12. package/dist/cjs/mcp/index.js.map +1 -1
  13. package/dist/cjs/mcp/prompts/index.js.map +1 -1
  14. package/dist/cjs/mcp/prompts/organize-files.js +3 -6
  15. package/dist/cjs/mcp/prompts/organize-files.js.map +1 -1
  16. package/dist/cjs/mcp/prompts/query-syntax.js +3 -6
  17. package/dist/cjs/mcp/prompts/query-syntax.js.map +1 -1
  18. package/dist/cjs/mcp/resources/file.js +3 -6
  19. package/dist/cjs/mcp/resources/file.js.map +1 -1
  20. package/dist/cjs/mcp/resources/index.js.map +1 -1
  21. package/dist/cjs/mcp/tools/file-move-to-trash.js +5 -11
  22. package/dist/cjs/mcp/tools/file-move-to-trash.js.map +1 -1
  23. package/dist/cjs/mcp/tools/file-move.js +11 -18
  24. package/dist/cjs/mcp/tools/file-move.js.map +1 -1
  25. package/dist/cjs/mcp/tools/file-upload.d.cts +69 -0
  26. package/dist/cjs/mcp/tools/file-upload.d.ts +69 -0
  27. package/dist/cjs/mcp/tools/file-upload.js +387 -0
  28. package/dist/cjs/mcp/tools/file-upload.js.map +1 -0
  29. package/dist/cjs/mcp/tools/files-search.js +7 -14
  30. package/dist/cjs/mcp/tools/files-search.js.map +1 -1
  31. package/dist/cjs/mcp/tools/folder-contents.js +7 -14
  32. package/dist/cjs/mcp/tools/folder-contents.js.map +1 -1
  33. package/dist/cjs/mcp/tools/folder-create.js +5 -11
  34. package/dist/cjs/mcp/tools/folder-create.js.map +1 -1
  35. package/dist/cjs/mcp/tools/folder-path.js +4 -8
  36. package/dist/cjs/mcp/tools/folder-path.js.map +1 -1
  37. package/dist/cjs/mcp/tools/folder-search.js +19 -24
  38. package/dist/cjs/mcp/tools/folder-search.js.map +1 -1
  39. package/dist/cjs/mcp/tools/index.d.cts +1 -0
  40. package/dist/cjs/mcp/tools/index.d.ts +1 -0
  41. package/dist/cjs/mcp/tools/index.js +4 -0
  42. package/dist/cjs/mcp/tools/index.js.map +1 -1
  43. package/dist/cjs/schemas/drive-query-schema.js +2 -3
  44. package/dist/cjs/schemas/drive-query-schema.js.map +1 -1
  45. package/dist/cjs/schemas/drive-validation.js.map +1 -1
  46. package/dist/cjs/schemas/index.js.map +1 -1
  47. package/dist/cjs/setup/config.js +11 -25
  48. package/dist/cjs/setup/config.js.map +1 -1
  49. package/dist/cjs/setup/http.js +15 -16
  50. package/dist/cjs/setup/http.js.map +1 -1
  51. package/dist/cjs/setup/index.js.map +1 -1
  52. package/dist/cjs/setup/oauth-google.js +9 -16
  53. package/dist/cjs/setup/oauth-google.js.map +1 -1
  54. package/dist/cjs/setup/runtime.d.cts +1 -1
  55. package/dist/cjs/setup/runtime.d.ts +1 -1
  56. package/dist/cjs/setup/runtime.js +11 -25
  57. package/dist/cjs/setup/runtime.js.map +1 -1
  58. package/dist/cjs/setup/stdio.js +15 -16
  59. package/dist/cjs/setup/stdio.js.map +1 -1
  60. package/dist/esm/constants.js.map +1 -1
  61. package/dist/esm/index.js.map +1 -1
  62. package/dist/esm/lib/create-store.js.map +1 -1
  63. package/dist/esm/lib/file-streaming.d.ts +35 -0
  64. package/dist/esm/lib/file-streaming.js +111 -0
  65. package/dist/esm/lib/file-streaming.js.map +1 -0
  66. package/dist/esm/lib/query-builder.js.map +1 -1
  67. package/dist/esm/mcp/index.js.map +1 -1
  68. package/dist/esm/mcp/prompts/index.js.map +1 -1
  69. package/dist/esm/mcp/prompts/organize-files.js.map +1 -1
  70. package/dist/esm/mcp/prompts/query-syntax.js.map +1 -1
  71. package/dist/esm/mcp/resources/file.js.map +1 -1
  72. package/dist/esm/mcp/resources/index.js.map +1 -1
  73. package/dist/esm/mcp/tools/file-move-to-trash.js.map +1 -1
  74. package/dist/esm/mcp/tools/file-move.js.map +1 -1
  75. package/dist/esm/mcp/tools/file-upload.d.ts +69 -0
  76. package/dist/esm/mcp/tools/file-upload.js +163 -0
  77. package/dist/esm/mcp/tools/file-upload.js.map +1 -0
  78. package/dist/esm/mcp/tools/files-search.js.map +1 -1
  79. package/dist/esm/mcp/tools/folder-contents.js.map +1 -1
  80. package/dist/esm/mcp/tools/folder-create.js.map +1 -1
  81. package/dist/esm/mcp/tools/folder-path.js.map +1 -1
  82. package/dist/esm/mcp/tools/folder-search.js.map +1 -1
  83. package/dist/esm/mcp/tools/index.d.ts +1 -0
  84. package/dist/esm/mcp/tools/index.js +1 -0
  85. package/dist/esm/mcp/tools/index.js.map +1 -1
  86. package/dist/esm/schemas/drive-query-schema.js.map +1 -1
  87. package/dist/esm/schemas/drive-validation.js.map +1 -1
  88. package/dist/esm/schemas/index.js.map +1 -1
  89. package/dist/esm/setup/config.js.map +1 -1
  90. package/dist/esm/setup/http.js.map +1 -1
  91. package/dist/esm/setup/index.js.map +1 -1
  92. package/dist/esm/setup/oauth-google.js.map +1 -1
  93. package/dist/esm/setup/runtime.d.ts +1 -1
  94. package/dist/esm/setup/runtime.js.map +1 -1
  95. package/dist/esm/setup/stdio.js.map +1 -1
  96. package/dist/esm/types.js.map +1 -1
  97. package/package.json +10 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-drive/src/mcp/prompts/organize-files.ts"],"sourcesContent":["import type { PromptModule } from '@mcp-z/server';\n\nexport default function createPrompt() {\n const config = {\n description: 'Help organize and manage files in Google Drive',\n argsSchema: {} as const,\n };\n\n return {\n name: 'organize-files',\n config,\n handler: async () => ({\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: 'You are an expert file organizer assistant. Help me organize my Google Drive files.',\n },\n },\n ],\n }),\n } satisfies PromptModule;\n}\n"],"names":["createPrompt","config","description","argsSchema","name","handler","messages","role","content","type","text"],"mappings":";;;;+BAEA;;;eAAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAT,SAASA;IACtB,IAAMC,SAAS;QACbC,aAAa;QACbC,YAAY,CAAC;IACf;IAEA,OAAO;QACLC,MAAM;QACNH,QAAAA;QACAI,SAAS;;;;;wBAAa;4BACpBC,QAAQ;gCACN;oCACEC,MAAM;oCACNC,SAAS;wCACPC,MAAM;wCACNC,MAAM;oCACR;gCACF;;wBAEJ;;;;;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/mcp-drive/src/mcp/prompts/organize-files.ts"],"sourcesContent":["import type { PromptModule } from '@mcp-z/server';\n\nexport default function createPrompt() {\n const config = {\n description: 'Help organize and manage files in Google Drive',\n argsSchema: {} as const,\n };\n\n return {\n name: 'organize-files',\n config,\n handler: async () => ({\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: 'You are an expert file organizer assistant. Help me organize my Google Drive files.',\n },\n },\n ],\n }),\n } satisfies PromptModule;\n}\n"],"names":["createPrompt","config","description","argsSchema","name","handler","messages","role","content","type","text"],"mappings":";;;;+BAEA;;;eAAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAT,SAASA;IACtB,IAAMC,SAAS;QACbC,aAAa;QACbC,YAAY,CAAC;IACf;IAEA,OAAO;QACLC,MAAM;QACNH,QAAAA;QACAI,SAAS,SAATA;;;;;wBAAsB;4BACpBC,QAAQ;gCACN;oCACEC,MAAM;oCACNC,SAAS;wCACPC,MAAM;wCACNC,MAAM;oCACR;gCACF;;wBAEJ;;;;;IACF;AACF"}
@@ -16,11 +16,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
16
16
  reject(error);
17
17
  return;
18
18
  }
19
- if (info.done) {
20
- resolve(value);
21
- } else {
22
- Promise.resolve(value).then(_next, _throw);
23
- }
19
+ if (info.done) resolve(value);
20
+ else Promise.resolve(value).then(_next, _throw);
24
21
  }
25
22
  function _async_to_generator(fn) {
26
23
  return function() {
@@ -140,7 +137,7 @@ function createPrompt() {
140
137
  var config = {
141
138
  description: 'Reference guide for Google Drive query syntax'
142
139
  };
143
- var handler = function(_args, _extra) {
140
+ var handler = function handler(_args, _extra) {
144
141
  return _async_to_generator(function() {
145
142
  return _ts_generator(this, function(_state) {
146
143
  return [
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-drive/src/mcp/prompts/query-syntax.ts"],"sourcesContent":["import type { PromptModule } from '@mcp-z/server';\nimport type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';\nimport type { ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';\n\nexport default function createPrompt() {\n const config = {\n description: 'Reference guide for Google Drive query syntax',\n };\n\n const handler = async (_args: { [x: string]: unknown }, _extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => {\n return {\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: `# Google Drive Query Syntax Reference\n\n## Logical Operators\n- \\`$and\\`: Array of conditions that ALL must match\n- \\`$or\\`: Array of conditions where ANY must match\n- \\`$not\\`: Condition that must NOT match\n\n## File/Folder Fields\n- \\`name\\`: Search by name (partial match, case-insensitive)\n- \\`mimeType\\`: Filter by MIME type\n- \\`fullText\\`: Search file content and metadata\n- \\`parentId\\`: Search within folder (use \"root\" for My Drive)\n- \\`owner\\`: Filter by owner email\n\n## Boolean Flags\n- \\`starred\\`: true/false\n- \\`sharedWithMe\\`: true/false\n- \\`trashed\\`: true/false\n\n## Date Range\n\\`\\`\\`json\n{ \"modifiedTime\": { \"$gte\": \"2024-01-01\", \"$lt\": \"2024-12-31\" } }\n\\`\\`\\`\n\n## Common MIME Types\n- \\`application/vnd.google-apps.folder\\`: Folders\n- \\`application/vnd.google-apps.document\\`: Google Docs\n- \\`application/vnd.google-apps.spreadsheet\\`: Google Sheets\n- \\`application/vnd.google-apps.presentation\\`: Google Slides\n- \\`application/pdf\\`: PDF files\n- \\`image/jpeg\\`, \\`image/png\\`: Images\n\n## Field Operators (for multi-value fields)\n- \\`$any\\`: OR - matches if ANY value matches\n- \\`$all\\`: AND - matches if ALL values match\n- \\`$none\\`: NOT - matches if NONE match\n\n## Escape Hatch\n- \\`rawDriveQuery\\`: Raw Google Drive query syntax\n\n## Example Queries\n\\`\\`\\`json\n// PDFs modified this year\n{ \"mimeType\": \"application/pdf\", \"modifiedTime\": { \"$gte\": \"2024-01-01\" } }\n\n// Starred spreadsheets\n{ \"mimeType\": \"application/vnd.google-apps.spreadsheet\", \"starred\": true }\n\n// Files in specific folder\n{ \"parentId\": \"1abc123xyz\" }\n\n// Search by name\n{ \"name\": \"budget\" }\n\n// Complex: shared PDFs or Docs\n{ \"$or\": [\n { \"mimeType\": \"application/pdf\", \"sharedWithMe\": true },\n { \"mimeType\": \"application/vnd.google-apps.document\", \"sharedWithMe\": true }\n]}\n\\`\\`\\``,\n },\n },\n ],\n };\n };\n\n return {\n name: 'query-syntax',\n config,\n handler,\n } satisfies PromptModule;\n}\n"],"names":["createPrompt","config","description","handler","_args","_extra","messages","role","content","type","text","name"],"mappings":";;;;+BAIA;;;eAAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAT,SAASA;IACtB,IAAMC,SAAS;QACbC,aAAa;IACf;IAEA,IAAMC,UAAU,SAAOC,OAAiCC;;;gBACtD;;oBAAO;wBACLC,QAAQ;4BACN;gCACEC,MAAM;gCACNC,SAAS;oCACPC,MAAM;oCACNC,MAAM;gCA4DR;4BACF;;oBAEJ;;;QACF;;IAEA,OAAO;QACLC,MAAM;QACNV,QAAAA;QACAE,SAAAA;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/mcp-drive/src/mcp/prompts/query-syntax.ts"],"sourcesContent":["import type { PromptModule } from '@mcp-z/server';\nimport type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';\nimport type { ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';\n\nexport default function createPrompt() {\n const config = {\n description: 'Reference guide for Google Drive query syntax',\n };\n\n const handler = async (_args: { [x: string]: unknown }, _extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => {\n return {\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: `# Google Drive Query Syntax Reference\n\n## Logical Operators\n- \\`$and\\`: Array of conditions that ALL must match\n- \\`$or\\`: Array of conditions where ANY must match\n- \\`$not\\`: Condition that must NOT match\n\n## File/Folder Fields\n- \\`name\\`: Search by name (partial match, case-insensitive)\n- \\`mimeType\\`: Filter by MIME type\n- \\`fullText\\`: Search file content and metadata\n- \\`parentId\\`: Search within folder (use \"root\" for My Drive)\n- \\`owner\\`: Filter by owner email\n\n## Boolean Flags\n- \\`starred\\`: true/false\n- \\`sharedWithMe\\`: true/false\n- \\`trashed\\`: true/false\n\n## Date Range\n\\`\\`\\`json\n{ \"modifiedTime\": { \"$gte\": \"2024-01-01\", \"$lt\": \"2024-12-31\" } }\n\\`\\`\\`\n\n## Common MIME Types\n- \\`application/vnd.google-apps.folder\\`: Folders\n- \\`application/vnd.google-apps.document\\`: Google Docs\n- \\`application/vnd.google-apps.spreadsheet\\`: Google Sheets\n- \\`application/vnd.google-apps.presentation\\`: Google Slides\n- \\`application/pdf\\`: PDF files\n- \\`image/jpeg\\`, \\`image/png\\`: Images\n\n## Field Operators (for multi-value fields)\n- \\`$any\\`: OR - matches if ANY value matches\n- \\`$all\\`: AND - matches if ALL values match\n- \\`$none\\`: NOT - matches if NONE match\n\n## Escape Hatch\n- \\`rawDriveQuery\\`: Raw Google Drive query syntax\n\n## Example Queries\n\\`\\`\\`json\n// PDFs modified this year\n{ \"mimeType\": \"application/pdf\", \"modifiedTime\": { \"$gte\": \"2024-01-01\" } }\n\n// Starred spreadsheets\n{ \"mimeType\": \"application/vnd.google-apps.spreadsheet\", \"starred\": true }\n\n// Files in specific folder\n{ \"parentId\": \"1abc123xyz\" }\n\n// Search by name\n{ \"name\": \"budget\" }\n\n// Complex: shared PDFs or Docs\n{ \"$or\": [\n { \"mimeType\": \"application/pdf\", \"sharedWithMe\": true },\n { \"mimeType\": \"application/vnd.google-apps.document\", \"sharedWithMe\": true }\n]}\n\\`\\`\\``,\n },\n },\n ],\n };\n };\n\n return {\n name: 'query-syntax',\n config,\n handler,\n } satisfies PromptModule;\n}\n"],"names":["createPrompt","config","description","handler","_args","_extra","messages","role","content","type","text","name"],"mappings":";;;;+BAIA;;;eAAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAT,SAASA;IACtB,IAAMC,SAAS;QACbC,aAAa;IACf;IAEA,IAAMC,UAAU,iBAAOC,OAAiCC;;;gBACtD;;oBAAO;wBACLC,QAAQ;4BACN;gCACEC,MAAM;gCACNC,SAAS;oCACPC,MAAM;oCACNC,MAAM;gCA4DR;4BACF;;oBAEJ;;;QACF;;IAEA,OAAO;QACLC,MAAM;QACNV,QAAAA;QACAE,SAAAA;IACF;AACF"}
@@ -18,11 +18,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
18
18
  reject(error);
19
19
  return;
20
20
  }
21
- if (info.done) {
22
- resolve(value);
23
- } else {
24
- Promise.resolve(value).then(_next, _throw);
25
- }
21
+ if (info.done) resolve(value);
22
+ else Promise.resolve(value).then(_next, _throw);
26
23
  }
27
24
  function _async_to_generator(fn) {
28
25
  return function() {
@@ -146,7 +143,7 @@ function createResource() {
146
143
  description: 'Drive file resource',
147
144
  mimeType: 'application/json'
148
145
  };
149
- var handler = function(uri, variables, extra) {
146
+ var handler = function handler(uri, variables, extra) {
150
147
  return _async_to_generator(function() {
151
148
  var fileId, _logger_debug, logger, authContext, drive, resp, data, error, _logger_debug1, logger1;
152
149
  return _ts_generator(this, function(_state) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-drive/src/mcp/resources/file.ts"],"sourcesContent":["import type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport type { ResourceConfig, ResourceModule } from '@mcp-z/server';\nimport { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';\nimport type { ReadResourceResult, ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';\nimport { google } from 'googleapis';\n\nexport default function createResource() {\n const template = new ResourceTemplate('drive://files/{fileId}', {\n list: undefined,\n });\n const config: ResourceConfig = {\n description: 'Drive file resource',\n mimeType: 'application/json',\n };\n\n const handler = async (uri: URL, variables: Record<string, string | string[]>, extra: RequestHandlerExtra<ServerRequest, ServerNotification>): Promise<ReadResourceResult> => {\n // Extract fileId and handle both string and string[] cases\n const fileId = Array.isArray(variables.fileId) ? variables.fileId[0] : variables.fileId;\n\n try {\n // Validate fileId exists and is a string\n if (!fileId || typeof fileId !== 'string') {\n return {\n contents: [\n {\n uri: uri.href,\n mimeType: 'application/json',\n text: JSON.stringify({\n error: 'Missing or invalid fileId in resource URI',\n }),\n },\n ],\n };\n }\n\n // Safe type guard to access middleware-enriched extra\n const { logger, authContext } = extra as unknown as EnrichedExtra;\n const drive = google.drive({ version: 'v3', auth: authContext.auth });\n const resp = await drive.files.get({\n fileId,\n fields: 'id,name,mimeType,size,modifiedTime,owners,webViewLink',\n });\n const data = resp.data;\n logger.debug?.({ fileId, fileName: data?.name }, 'drive-file resource fetch success');\n return {\n contents: [\n {\n uri: uri.href,\n mimeType: 'application/json',\n text: JSON.stringify(data || {}),\n },\n ],\n };\n } catch (error) {\n const { logger } = extra as unknown as EnrichedExtra;\n logger.debug?.(error as Record<string, unknown>, 'drive resource fetch failed');\n return {\n contents: [\n {\n uri: uri.href,\n mimeType: 'application/json',\n text: JSON.stringify({ error: (error as Error).message }),\n },\n ],\n };\n }\n };\n\n return {\n name: 'file',\n template,\n config,\n handler,\n } satisfies ResourceModule;\n}\n"],"names":["createResource","template","ResourceTemplate","list","undefined","config","description","mimeType","handler","uri","variables","extra","fileId","logger","authContext","drive","resp","data","error","Array","isArray","contents","href","text","JSON","stringify","google","version","auth","files","get","fields","debug","fileName","name","message"],"mappings":";;;;+BAOA;;;eAAwBA;;;mBALS;0BAGV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAER,SAASA;IACtB,IAAMC,WAAW,IAAIC,qBAAgB,CAAC,0BAA0B;QAC9DC,MAAMC;IACR;IACA,IAAMC,SAAyB;QAC7BC,aAAa;QACbC,UAAU;IACZ;IAEA,IAAMC,UAAU,SAAOC,KAAUC,WAA8CC;;gBAEvEC,QA0BJC,eAPQA,QAAQC,aACVC,OACAC,MA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;;;QAEJ;;IAEA,OAAO;QACLD,MAAM;QACNjC,UAAAA;QACAI,QAAAA;QACAG,SAAAA;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/mcp-drive/src/mcp/resources/file.ts"],"sourcesContent":["import type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport type { ResourceConfig, ResourceModule } from '@mcp-z/server';\nimport { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';\nimport type { ReadResourceResult, ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';\nimport { google } from 'googleapis';\n\nexport default function createResource() {\n const template = new ResourceTemplate('drive://files/{fileId}', {\n list: undefined,\n });\n const config: ResourceConfig = {\n description: 'Drive file resource',\n mimeType: 'application/json',\n };\n\n const handler = async (uri: URL, variables: Record<string, string | string[]>, extra: RequestHandlerExtra<ServerRequest, ServerNotification>): Promise<ReadResourceResult> => {\n // Extract fileId and handle both string and string[] cases\n const fileId = Array.isArray(variables.fileId) ? variables.fileId[0] : variables.fileId;\n\n try {\n // Validate fileId exists and is a string\n if (!fileId || typeof fileId !== 'string') {\n return {\n contents: [\n {\n uri: uri.href,\n mimeType: 'application/json',\n text: JSON.stringify({\n error: 'Missing or invalid fileId in resource URI',\n }),\n },\n ],\n };\n }\n\n // Safe type guard to access middleware-enriched extra\n const { logger, authContext } = extra as unknown as EnrichedExtra;\n const drive = google.drive({ version: 'v3', auth: authContext.auth });\n const resp = await drive.files.get({\n fileId,\n fields: 'id,name,mimeType,size,modifiedTime,owners,webViewLink',\n });\n const data = resp.data;\n logger.debug?.({ fileId, fileName: data?.name }, 'drive-file resource fetch success');\n return {\n contents: [\n {\n uri: uri.href,\n mimeType: 'application/json',\n text: JSON.stringify(data || {}),\n },\n ],\n };\n } catch (error) {\n const { logger } = extra as unknown as EnrichedExtra;\n logger.debug?.(error as Record<string, unknown>, 'drive resource fetch failed');\n return {\n contents: [\n {\n uri: uri.href,\n mimeType: 'application/json',\n text: JSON.stringify({ error: (error as Error).message }),\n },\n ],\n };\n }\n };\n\n return {\n name: 'file',\n template,\n config,\n handler,\n } satisfies ResourceModule;\n}\n"],"names":["createResource","template","ResourceTemplate","list","undefined","config","description","mimeType","handler","uri","variables","extra","fileId","logger","authContext","drive","resp","data","error","Array","isArray","contents","href","text","JSON","stringify","google","version","auth","files","get","fields","debug","fileName","name","message"],"mappings":";;;;+BAOA;;;eAAwBA;;;mBALS;0BAGV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAER,SAASA;IACtB,IAAMC,WAAW,IAAIC,qBAAgB,CAAC,0BAA0B;QAC9DC,MAAMC;IACR;IACA,IAAMC,SAAyB;QAC7BC,aAAa;QACbC,UAAU;IACZ;IAEA,IAAMC,UAAU,iBAAOC,KAAUC,WAA8CC;;gBAEvEC,QA0BJC,eAPQA,QAAQC,aACVC,OACAC,MAIAC,MAWCC,OAEPL,gBADQA;;;;wBAtCV,2DAA2D;wBACrDD,SAASO,MAAMC,OAAO,CAACV,UAAUE,MAAM,IAAIF,UAAUE,MAAM,CAAC,EAAE,GAAGF,UAAUE,MAAM;;;;;;;;;wBAGrF,yCAAyC;wBACzC,IAAI,CAACA,UAAU,OAAOA,WAAW,UAAU;4BACzC;;gCAAO;oCACLS,QAAQ;wCACN;4CACEZ,KAAKA,IAAIa,IAAI;4CACbf,UAAU;4CACVgB,MAAMC,KAAKC,SAAS,CAAC;gDACnBP,OAAO;4CACT;wCACF;;gCAEJ;;wBACF;wBAEA,sDAAsD;wBAC9CL,SAAwBF,MAAxBE,QAAQC,cAAgBH,MAAhBG;wBACVC,QAAQW,kBAAM,CAACX,KAAK,CAAC;4BAAEY,SAAS;4BAAMC,MAAMd,YAAYc,IAAI;wBAAC;wBACtD;;4BAAMb,MAAMc,KAAK,CAACC,GAAG,CAAC;gCACjClB,QAAAA;gCACAmB,QAAQ;4BACV;;;wBAHMf,OAAO;wBAIPC,OAAOD,KAAKC,IAAI;yBACtBJ,gBAAAA,OAAOmB,KAAK,cAAZnB,oCAAAA,mBAAAA,QAAe;4BAAED,QAAAA;4BAAQqB,QAAQ,EAAEhB,iBAAAA,2BAAAA,KAAMiB,IAAI;wBAAC,GAAG;wBACjD;;4BAAO;gCACLb,QAAQ;oCACN;wCACEZ,KAAKA,IAAIa,IAAI;wCACbf,UAAU;wCACVgB,MAAMC,KAAKC,SAAS,CAACR,QAAQ,CAAC;oCAChC;;4BAEJ;;;wBACOC;wBACCL,UAAWF,MAAXE;yBACRA,iBAAAA,QAAOmB,KAAK,cAAZnB,qCAAAA,oBAAAA,SAAeK,OAAkC;wBACjD;;4BAAO;gCACLG,QAAQ;oCACN;wCACEZ,KAAKA,IAAIa,IAAI;wCACbf,UAAU;wCACVgB,MAAMC,KAAKC,SAAS,CAAC;4CAAEP,OAAO,AAACA,MAAgBiB,OAAO;wCAAC;oCACzD;;4BAEJ;;;;;;;;QAEJ;;IAEA,OAAO;QACLD,MAAM;QACNjC,UAAAA;QACAI,QAAAA;QACAG,SAAAA;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-drive/src/mcp/resources/index.ts"],"sourcesContent":["export { default as file } from './file.ts';\n"],"names":["file"],"mappings":";;;;+BAAoBA;;;eAAAA,eAAI;;;6DAAQ"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/mcp-drive/src/mcp/resources/index.ts"],"sourcesContent":["export { default as file } from './file.ts';\n"],"names":["file"],"mappings":";;;;+BAAoBA;;;eAAAA,eAAI;;;6DAAQ"}
@@ -20,11 +20,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
20
20
  reject(error);
21
21
  return;
22
22
  }
23
- if (info.done) {
24
- resolve(value);
25
- } else {
26
- Promise.resolve(value).then(_next, _throw);
27
- }
23
+ if (info.done) resolve(value);
24
+ else Promise.resolve(value).then(_next, _throw);
28
25
  }
29
26
  function _async_to_generator(fn) {
30
27
  return function() {
@@ -49,17 +46,14 @@ function _define_property(obj, key, value) {
49
46
  configurable: true,
50
47
  writable: true
51
48
  });
52
- } else {
53
- obj[key] = value;
54
- }
49
+ } else obj[key] = value;
55
50
  return obj;
56
51
  }
57
52
  function _instanceof(left, right) {
53
+ "@swc/helpers - instanceof";
58
54
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
59
55
  return !!right[Symbol.hasInstance](left);
60
- } else {
61
- return left instanceof right;
62
- }
56
+ } else return left instanceof right;
63
57
  }
64
58
  function _object_spread(target) {
65
59
  for(var i = 1; i < arguments.length; i++){
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-drive/src/mcp/tools/file-move-to-trash.ts"],"sourcesContent":["import type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport { type CallToolResult, ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';\nimport { google } from 'googleapis';\nimport { z } from 'zod';\n\nconst MAX_BATCH_SIZE = 1000;\n\nconst inputSchema = z.object({\n ids: z.array(z.string().min(1)).min(1).max(MAX_BATCH_SIZE).describe('File IDs to soft delete (move to trash)'),\n});\n\n// Success branch schema\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n operationSummary: z.string().describe('Human-readable summary of the operation'),\n totalCount: z.number().describe('Total number of files requested to trash'),\n successCount: z.number().describe('Number of files successfully moved to trash'),\n failureCount: z.number().describe('Number of files that failed to move'),\n recoverable: z.boolean().describe('Whether trashed files can be restored'),\n recoverableDays: z.number().describe('Days until permanent deletion'),\n failures: z\n .array(\n z.object({\n id: z.string().describe('ID of the file that failed'),\n error: z.string().describe('Error message explaining the failure'),\n })\n )\n .optional()\n .describe('Details of any files that failed to trash'),\n});\n\n// Output schema with auth_required support\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n title: 'Move Files to Trash',\n description: 'Move files to trash (recoverable for 30 days).',\n inputSchema: inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\nasync function handler({ ids }: Input, extra: EnrichedExtra): Promise<CallToolResult> {\n const logger = extra.logger;\n logger.info('drive.file.moveToTrash called', { count: ids.length });\n\n try {\n const drive = google.drive({ version: 'v3', auth: extra.authContext.auth });\n\n const results = await Promise.allSettled(\n ids.map(async (id) => {\n await drive.files.update({\n fileId: id,\n requestBody: { trashed: true },\n });\n return id;\n })\n );\n\n // Separate successes and failures\n const failures: Array<{ id: string; error: string }> = [];\n\n results.forEach((result, index) => {\n const id = ids[index];\n if (!id) return;\n\n if (result.status === 'rejected') {\n const errorMessage = result.reason instanceof Error ? result.reason.message : String(result.reason);\n failures.push({ id, error: errorMessage });\n }\n });\n\n const successCount = ids.length - failures.length;\n const failureCount = failures.length;\n const totalCount = ids.length;\n\n logger.info('drive.file.moveToTrash completed', {\n totalCount,\n successCount,\n failureCount,\n });\n\n const operationSummary = failureCount === 0 ? `Moved ${successCount} file${successCount === 1 ? '' : 's'} to trash (recoverable for 30 days)` : `Moved ${successCount} of ${totalCount} file${totalCount === 1 ? '' : 's'} to trash (${failureCount} failed, recoverable for 30 days)`;\n\n const result: Output = {\n type: 'success' as const,\n operationSummary,\n totalCount,\n successCount,\n failureCount,\n recoverable: true,\n recoverableDays: 30,\n ...(failures.length > 0 && { failures }),\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('drive.file.moveToTrash error', { error: message });\n\n // Throw McpError\n throw new McpError(ErrorCode.InternalError, `Error moving files to trash: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'file-move-to-trash' as const,\n config,\n handler,\n };\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","MAX_BATCH_SIZE","inputSchema","z","object","ids","array","string","min","max","describe","successBranchSchema","type","literal","operationSummary","totalCount","number","successCount","failureCount","recoverable","boolean","recoverableDays","failures","id","error","optional","outputSchema","discriminatedUnion","config","title","description","result","handler","extra","logger","drive","results","message","info","count","length","google","version","auth","authContext","Promise","allSettled","map","files","update","fileId","requestBody","trashed","forEach","index","status","errorMessage","reason","Error","String","push","content","text","JSON","stringify","structuredContent","McpError","ErrorCode","InternalError","stack","undefined","name"],"mappings":";;;;+BA2HA;;;eAAwBA;;;2BA1HA;qBAIiC;0BAClC;mBACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAJlB,IAAM,AAAEC,2BAA6BC,oBAAO,CAApCD;AAMR,IAAME,iBAAiB;AAEvB,IAAMC,cAAcC,MAAC,CAACC,MAAM,CAAC;IAC3BC,KAAKF,MAAC,CAACG,KAAK,CAACH,MAAC,CAACI,MAAM,GAAGC,GAAG,CAAC,IAAIA,GAAG,CAAC,GAAGC,GAAG,CAACR,gBAAgBS,QAAQ,CAAC;AACtE;AAEA,wBAAwB;AACxB,IAAMC,sBAAsBR,MAAC,CAACC,MAAM,CAAC;IACnCQ,MAAMT,MAAC,CAACU,OAAO,CAAC;IAChBC,kBAAkBX,MAAC,CAACI,MAAM,GAAGG,QAAQ,CAAC;IACtCK,YAAYZ,MAAC,CAACa,MAAM,GAAGN,QAAQ,CAAC;IAChCO,cAAc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OAAO,GAAGsB,OAAOnC;oBAChEU,OAAOV,KAAK,CAAC,gCAAgC;wBAAEA,OAAOa;oBAAQ;oBAE9D,iBAAiB;oBACjB,MAAM,IAAI6B,eAAQ,CAACC,gBAAS,CAACC,aAAa,EAAE,AAAC,gCAAuC,OAAR/B,UAAW;wBACrFgC,OAAO7C,AAAK,YAALA,OAAiBkC,SAAQlC,MAAM6C,KAAK,GAAGC;oBAChD;;;;;;;IAEJ;;AAEe,SAASxE;IACtB,OAAO;QACLyE,MAAM;QACN3C,QAAAA;QACAI,SAAAA;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/mcp-drive/src/mcp/tools/file-move-to-trash.ts"],"sourcesContent":["import type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport { type CallToolResult, ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';\nimport { google } from 'googleapis';\nimport { z } from 'zod';\n\nconst MAX_BATCH_SIZE = 1000;\n\nconst inputSchema = z.object({\n ids: z.array(z.string().min(1)).min(1).max(MAX_BATCH_SIZE).describe('File IDs to soft delete (move to trash)'),\n});\n\n// Success branch schema\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n operationSummary: z.string().describe('Human-readable summary of the operation'),\n totalCount: z.number().describe('Total number of files requested to trash'),\n successCount: z.number().describe('Number of files successfully moved to trash'),\n failureCount: z.number().describe('Number of files that failed to move'),\n recoverable: z.boolean().describe('Whether trashed files can be restored'),\n recoverableDays: z.number().describe('Days until permanent deletion'),\n failures: z\n .array(\n z.object({\n id: z.string().describe('ID of the file that failed'),\n error: z.string().describe('Error message explaining the failure'),\n })\n )\n .optional()\n .describe('Details of any files that failed to trash'),\n});\n\n// Output schema with auth_required support\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n title: 'Move Files to Trash',\n description: 'Move files to trash (recoverable for 30 days).',\n inputSchema: inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\nasync function handler({ ids }: Input, extra: EnrichedExtra): Promise<CallToolResult> {\n const logger = extra.logger;\n logger.info('drive.file.moveToTrash called', { count: ids.length });\n\n try {\n const drive = google.drive({ version: 'v3', auth: extra.authContext.auth });\n\n const results = await Promise.allSettled(\n ids.map(async (id) => {\n await drive.files.update({\n fileId: id,\n requestBody: { trashed: true },\n });\n return id;\n })\n );\n\n // Separate successes and failures\n const failures: Array<{ id: string; error: string }> = [];\n\n results.forEach((result, index) => {\n const id = ids[index];\n if (!id) return;\n\n if (result.status === 'rejected') {\n const errorMessage = result.reason instanceof Error ? result.reason.message : String(result.reason);\n failures.push({ id, error: errorMessage });\n }\n });\n\n const successCount = ids.length - failures.length;\n const failureCount = failures.length;\n const totalCount = ids.length;\n\n logger.info('drive.file.moveToTrash completed', {\n totalCount,\n successCount,\n failureCount,\n });\n\n const operationSummary = failureCount === 0 ? `Moved ${successCount} file${successCount === 1 ? '' : 's'} to trash (recoverable for 30 days)` : `Moved ${successCount} of ${totalCount} file${totalCount === 1 ? '' : 's'} to trash (${failureCount} failed, recoverable for 30 days)`;\n\n const result: Output = {\n type: 'success' as const,\n operationSummary,\n totalCount,\n successCount,\n failureCount,\n recoverable: true,\n recoverableDays: 30,\n ...(failures.length > 0 && { failures }),\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('drive.file.moveToTrash error', { error: message });\n\n // Throw McpError\n throw new McpError(ErrorCode.InternalError, `Error moving files to trash: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'file-move-to-trash' as const,\n config,\n handler,\n };\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","MAX_BATCH_SIZE","inputSchema","z","object","ids","array","string","min","max","describe","successBranchSchema","type","literal","operationSummary","totalCount","number","successCount","failureCount","recoverable","boolean","recoverableDays","failures","id","error","optional","outputSchema","discriminatedUnion","config","title","description","result","handler","extra","logger","drive","results","message","info","count","length","google","version","auth","authContext","Promise","allSettled","map","files","update","fileId","requestBody","trashed","forEach","index","status","errorMessage","reason","Error","String","push","content","text","JSON","stringify","structuredContent","McpError","ErrorCode","InternalError","stack","undefined","name"],"mappings":";;;;+BA2HA;;;eAAwBA;;;2BA1HA;qBAIiC;0BAClC;mBACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAJlB,IAAM,AAAEC,2BAA6BC,oBAAO,CAApCD;AAMR,IAAME,iBAAiB;AAEvB,IAAMC,cAAcC,MAAC,CAACC,MAAM,CAAC;IAC3BC,KAAKF,MAAC,CAACG,KAAK,CAACH,MAAC,CAACI,MAAM,GAAGC,GAAG,CAAC,IAAIA,GAAG,CAAC,GAAGC,GAAG,CAACR,gBAAgBS,QAAQ,CAAC;AACtE;AAEA,wBAAwB;AACxB,IAAMC,sBAAsBR,MAAC,CAACC,MAAM,CAAC;IACnCQ,MAAMT,MAAC,CAACU,OAAO,CAAC;IAChBC,kBAAkBX,MAAC,CAACI,MAAM,GAAGG,QAAQ,CAAC;IACtCK,YAAYZ,MAAC,CAACa,MAAM,GAAGN,QAAQ,CAAC;IAChCO,cAAcd,MAAC,CAACa,MAAM,GAAGN,QAAQ,CAAC;IAClCQ,cAAcf,MAAC,CAACa,MAAM,GAAGN,QAAQ,CAAC;IAClCS,aAAahB,MAAC,CAACiB,OAAO,GAAGV,QAAQ,CAAC;IAClCW,iBAAiBlB,MAAC,CAACa,MAA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UAAW;wBACrFgC,OAAO7C,AAAK,YAALA,OAAiBkC,SAAQlC,MAAM6C,KAAK,GAAGC;oBAChD;;;;;;;IAEJ;;AAEe,SAASxE;IACtB,OAAO;QACLyE,MAAM;QACN3C,QAAAA;QACAI,SAAAA;IACF;AACF"}
@@ -20,11 +20,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
20
20
  reject(error);
21
21
  return;
22
22
  }
23
- if (info.done) {
24
- resolve(value);
25
- } else {
26
- Promise.resolve(value).then(_next, _throw);
27
- }
23
+ if (info.done) resolve(value);
24
+ else Promise.resolve(value).then(_next, _throw);
28
25
  }
29
26
  function _async_to_generator(fn) {
30
27
  return function() {
@@ -49,17 +46,14 @@ function _define_property(obj, key, value) {
49
46
  configurable: true,
50
47
  writable: true
51
48
  });
52
- } else {
53
- obj[key] = value;
54
- }
49
+ } else obj[key] = value;
55
50
  return obj;
56
51
  }
57
52
  function _instanceof(left, right) {
53
+ "@swc/helpers - instanceof";
58
54
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
59
55
  return !!right[Symbol.hasInstance](left);
60
- } else {
61
- return left instanceof right;
62
- }
56
+ } else return left instanceof right;
63
57
  }
64
58
  function _object_spread(target) {
65
59
  for(var i = 1; i < arguments.length; i++){
@@ -91,19 +85,14 @@ function ownKeys(object, enumerableOnly) {
91
85
  }
92
86
  function _object_spread_props(target, source) {
93
87
  source = source != null ? source : {};
94
- if (Object.getOwnPropertyDescriptors) {
95
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
96
- } else {
88
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
89
+ else {
97
90
  ownKeys(Object(source)).forEach(function(key) {
98
91
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
99
92
  });
100
93
  }
101
94
  return target;
102
95
  }
103
- function _type_of(obj) {
104
- "@swc/helpers - typeof";
105
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
106
- }
107
96
  function _ts_generator(thisArg, body) {
108
97
  var f, y, t, _ = {
109
98
  label: 0,
@@ -203,6 +192,10 @@ function _ts_generator(thisArg, body) {
203
192
  };
204
193
  }
205
194
  }
195
+ function _type_of(obj) {
196
+ "@swc/helpers - typeof";
197
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
198
+ }
206
199
  var AuthRequiredBranchSchema = _oauthgoogle.schemas.AuthRequiredBranchSchema;
207
200
  function isDriveApiError(error) {
208
201
  return (typeof error === "undefined" ? "undefined" : _type_of(error)) === 'object' && error !== null && ('message' in error || 'code' in error);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-drive/src/mcp/tools/file-move.ts"],"sourcesContent":["import type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport { type CallToolResult, ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';\nimport type { drive_v3 } from 'googleapis';\nimport { google } from 'googleapis';\nimport { z } from 'zod';\nimport type { Logger } from '../../types.ts';\n\n// Type guard for Google Drive API errors\ninterface DriveApiError {\n message?: string;\n code?: number | string;\n}\n\nfunction isDriveApiError(error: unknown): error is DriveApiError {\n return typeof error === 'object' && error !== null && ('message' in error || 'code' in error);\n}\n\n// Types for results\ninterface MoveResult {\n fileId: string;\n fileName: string;\n oldParents: string[];\n newParent: string;\n webViewLink?: string;\n}\n\ninterface FailedMove {\n fileId: string;\n error: string;\n code?: string;\n}\n\nconst inputSchema = z.object({\n fileIds: z.union([z.string().min(1), z.array(z.string().min(1)).min(1).max(100)]).describe('File or folder ID(s) to move. Single ID or array (max 100 for batch)'),\n destinationFolderId: z.string().min(1).describe('Destination folder ID (use \"root\" for My Drive root)'),\n returnOldParents: z.boolean().optional().describe('Include old parent IDs in response for manual undo (recommended: true)'),\n});\n\n// Success branch schema\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n moved: z\n .array(\n z.object({\n fileId: z.string().describe('ID of the moved file'),\n fileName: z.string().describe('Name of the moved file'),\n oldParents: z.array(z.string()).describe('Previous parent folder IDs (for undo)'),\n newParent: z.string().describe('New parent folder ID'),\n webViewLink: z.string().optional().describe('URL to view the file'),\n })\n )\n .describe('Successfully moved files'),\n failed: z\n .array(\n z.object({\n fileId: z.string().describe('ID of the file that failed to move'),\n error: z.string().describe('Error message explaining the failure'),\n code: z.string().optional().describe('API error code if available'),\n })\n )\n .optional()\n .describe('Files that failed to move'),\n totalRequested: z.number().describe('Total number of files requested to move'),\n totalMoved: z.number().describe('Number of files successfully moved'),\n totalFailed: z.number().describe('Number of files that failed to move'),\n});\n\n// Output schema with auth_required support\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n title: 'Move Files',\n description: 'Move files/folders to destination folder. Returns oldParents for undo. Use \"root\" for My Drive root.',\n inputSchema: inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\n/**\n * Move a single file to a new parent folder\n */\nasync function moveSingleFile(\n drive: drive_v3.Drive,\n fileId: string,\n destinationFolderId: string,\n returnOldParents: boolean,\n logger: Logger\n): Promise<{\n success: boolean;\n result?: MoveResult;\n error?: FailedMove;\n}> {\n try {\n // Get current file metadata to get old parents\n const fileMetadata = await drive.files.get({\n fileId: fileId,\n fields: 'id,name,parents,webViewLink',\n });\n\n const oldParents = (fileMetadata.data.parents as string[] | undefined) || [];\n const fileName = (fileMetadata.data.name as string | undefined) || fileId;\n const webViewLink = fileMetadata.data.webViewLink as string | undefined;\n\n // Move file using addParents and removeParents\n await drive.files.update({\n fileId: fileId,\n addParents: destinationFolderId,\n removeParents: oldParents.join(','),\n fields: 'id,name,parents,webViewLink',\n });\n\n const result: MoveResult = {\n fileId: fileId,\n fileName: fileName,\n oldParents: returnOldParents ? oldParents : [],\n newParent: destinationFolderId,\n ...(webViewLink && { webViewLink }),\n };\n\n return { success: true, result };\n } catch (e: unknown) {\n const errorMessage = isDriveApiError(e) && e.message ? e.message : 'Unknown error';\n const errorCode = isDriveApiError(e) && e.code ? String(e.code) : undefined;\n logger.info('Failed to move file', { fileId, error: errorMessage });\n return {\n success: false,\n error: {\n fileId: fileId,\n error: errorMessage,\n ...(errorCode && { code: errorCode }),\n },\n };\n }\n}\n\n/**\n * Move multiple files using batch requests\n */\nasync function moveBatchFiles(\n drive: drive_v3.Drive,\n fileIds: string[],\n destinationFolderId: string,\n returnOldParents: boolean,\n _logger: Logger\n): Promise<{\n moved: MoveResult[];\n failed: FailedMove[];\n}> {\n const moved: MoveResult[] = [];\n const failed: FailedMove[] = [];\n\n // First, fetch metadata for all files in batch\n const metadataResults = await Promise.allSettled(\n fileIds.map(async (fileId) => {\n try {\n const response = await drive.files.get({\n fileId: fileId,\n fields: 'id,name,parents,webViewLink',\n });\n const webViewLink = response.data.webViewLink as string | undefined;\n return {\n fileId: fileId,\n name: (response.data.name as string | undefined) || fileId,\n parents: (response.data.parents as string[] | undefined) || [],\n ...(webViewLink && { webViewLink }),\n };\n } catch (e: unknown) {\n const message = isDriveApiError(e) && e.message ? e.message : String(e);\n throw new Error(`Failed to fetch metadata: ${message}`);\n }\n })\n );\n\n // Process metadata results\n const filesToMove: Array<{\n fileId: string;\n name: string;\n parents: string[];\n webViewLink?: string;\n }> = [];\n for (let i = 0; i < metadataResults.length; i++) {\n const result = metadataResults[i];\n if (result && result.status === 'fulfilled') {\n filesToMove.push(result.value);\n } else if (result && result.status === 'rejected') {\n const fileId = fileIds[i];\n if (fileId) {\n const errorCode = result.reason?.code ? String(result.reason.code) : undefined;\n failed.push({\n fileId: fileId,\n error: result.reason?.message || 'Failed to fetch file metadata',\n ...(errorCode && { code: errorCode }),\n });\n }\n }\n }\n\n // Now move files in batch\n const moveResults = await Promise.allSettled(\n filesToMove.map(async (file) => {\n try {\n await drive.files.update({\n fileId: file.fileId,\n addParents: destinationFolderId,\n removeParents: file.parents.join(','),\n fields: 'id',\n });\n return {\n fileId: file.fileId,\n fileName: file.name,\n oldParents: returnOldParents ? file.parents : [],\n newParent: destinationFolderId,\n ...(file.webViewLink && { webViewLink: file.webViewLink }),\n };\n } catch (e: unknown) {\n const message = isDriveApiError(e) && e.message ? e.message : String(e);\n throw new Error(`Failed to move: ${message}`);\n }\n })\n );\n\n // Process move results\n for (let i = 0; i < moveResults.length; i++) {\n const result = moveResults[i];\n if (result && result.status === 'fulfilled') {\n moved.push(result.value);\n } else if (result && result.status === 'rejected') {\n const file = filesToMove[i];\n if (file) {\n const errorCode = result.reason?.code ? String(result.reason.code) : undefined;\n failed.push({\n fileId: file.fileId,\n error: result.reason?.message || 'Failed to move file',\n ...(errorCode && { code: errorCode }),\n });\n }\n }\n }\n\n return { moved, failed };\n}\n\nasync function handler({ fileIds, destinationFolderId, returnOldParents = true }: Input, extra: EnrichedExtra): Promise<CallToolResult> {\n const logger = extra.logger;\n const isBatch = Array.isArray(fileIds);\n const fileIdArray = Array.isArray(fileIds) ? fileIds : [fileIds];\n\n logger.info('drive.file.move called', {\n fileCount: fileIdArray.length,\n isBatch,\n destinationFolderId,\n returnOldParents,\n });\n\n try {\n const drive = google.drive({ version: 'v3', auth: extra.authContext.auth });\n\n let moved: MoveResult[] = [];\n let failed: FailedMove[] = [];\n\n if (isBatch && fileIdArray.length > 1) {\n // Use batch API for multiple files\n const batchResult = await moveBatchFiles(drive, fileIdArray, destinationFolderId, returnOldParents, logger);\n moved = batchResult.moved;\n failed = batchResult.failed;\n } else {\n // Single file operation\n const fileId = fileIdArray[0];\n if (fileId) {\n const singleResult = await moveSingleFile(drive, fileId, destinationFolderId, returnOldParents, logger);\n if (singleResult.success && singleResult.result) {\n moved.push(singleResult.result);\n } else if (singleResult.error) {\n failed.push(singleResult.error);\n }\n }\n }\n\n logger.info('drive.file.move returning', {\n totalRequested: fileIdArray.length,\n totalMoved: moved.length,\n totalFailed: failed.length,\n });\n\n const result: Output = {\n type: 'success' as const,\n moved,\n ...(failed.length > 0 && { failed }),\n totalRequested: fileIdArray.length,\n totalMoved: moved.length,\n totalFailed: failed.length,\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('drive.file.move error', { error: message });\n\n // Throw McpError\n throw new McpError(ErrorCode.InternalError, `Error moving files: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'file-move' as const,\n config,\n handler,\n };\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","isDriveApiError","error","inputSchema","z","object","fileIds","union","string","min","array","max","describe","destinationFolderId","returnOldParents","boolean","optional","successBranchSchema","type","literal","moved","fileId","fileName","oldParents","newParent","webViewLink","failed","code","totalRequested","number","totalMoved","totalFailed","outputSchema","discriminatedUnion","config","title","description","result","moveSingleFile","drive","logger","fileMetadata","e","errorMessage","errorCode","files","get","fields","data","parents","name","update","addParents","removeParents","join","success","message","String","undefined","info","moveBatchFiles","_logger","metadataResults","filesToMove","i","moveResults","file","Promise","allSettled","map","response","Error","length","status","push","value","reason","handler","extra","isBatch","fileIdArray","batchResult","singleResult","Array","isArray","fileCount","google","version","auth","authContext","content","text","JSON","stringify","structuredContent","McpError","ErrorCode","InternalError","stack"],"mappings":";;;;+BAiUA;;;eAAwBA;;;2BAhUA;qBAIiC;0BAElC;mBACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AALlB,IAAM,A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;;oBAG5B;;wBAAO;4BACLkB,OAAO;gCACL;oCACExE,MAAM;oCACNyE,MAAMC,KAAKC,SAAS,CAACxD;gCACvB;;4BAEFyD,mBAAmB;gCAAEzD,QAAAA;4BAAO;wBAC9B;;;oBACOnC;oBACDsD,UAAUtD,AAAK,YAALA,OAAiBqE,SAAQrE,MAAMsD,OAAO,GAAGC,OAAOvD;oBAChEsC,OAAOtC,KAAK,CAAC,yBAAyB;wBAAEA,OAAOsD;oBAAQ;oBAEvD,iBAAiB;oBACjB,MAAM,IAAIuC,eAAQ,CAACC,gBAAS,CAACC,aAAa,EAAE,AAAC,uBAA8B,OAARzC,UAAW;wBAC5E0C,OAAOhG,AAAK,YAALA,OAAiBqE,SAAQrE,MAAMgG,KAAK,GAAGxC;oBAChD;;;;;;;IAEJ;;AAEe,SAAS5D;IACtB,OAAO;QACLoD,MAAM;QACNhB,QAAAA;QACA2C,SAAAA;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/mcp-drive/src/mcp/tools/file-move.ts"],"sourcesContent":["import type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport { type CallToolResult, ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';\nimport type { drive_v3 } from 'googleapis';\nimport { google } from 'googleapis';\nimport { z } from 'zod';\nimport type { Logger } from '../../types.ts';\n\n// Type guard for Google Drive API errors\ninterface DriveApiError {\n message?: string;\n code?: number | string;\n}\n\nfunction isDriveApiError(error: unknown): error is DriveApiError {\n return typeof error === 'object' && error !== null && ('message' in error || 'code' in error);\n}\n\n// Types for results\ninterface MoveResult {\n fileId: string;\n fileName: string;\n oldParents: string[];\n newParent: string;\n webViewLink?: string;\n}\n\ninterface FailedMove {\n fileId: string;\n error: string;\n code?: string;\n}\n\nconst inputSchema = z.object({\n fileIds: z.union([z.string().min(1), z.array(z.string().min(1)).min(1).max(100)]).describe('File or folder ID(s) to move. Single ID or array (max 100 for batch)'),\n destinationFolderId: z.string().min(1).describe('Destination folder ID (use \"root\" for My Drive root)'),\n returnOldParents: z.boolean().optional().describe('Include old parent IDs in response for manual undo (recommended: true)'),\n});\n\n// Success branch schema\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n moved: z\n .array(\n z.object({\n fileId: z.string().describe('ID of the moved file'),\n fileName: z.string().describe('Name of the moved file'),\n oldParents: z.array(z.string()).describe('Previous parent folder IDs (for undo)'),\n newParent: z.string().describe('New parent folder ID'),\n webViewLink: z.string().optional().describe('URL to view the file'),\n })\n )\n .describe('Successfully moved files'),\n failed: z\n .array(\n z.object({\n fileId: z.string().describe('ID of the file that failed to move'),\n error: z.string().describe('Error message explaining the failure'),\n code: z.string().optional().describe('API error code if available'),\n })\n )\n .optional()\n .describe('Files that failed to move'),\n totalRequested: z.number().describe('Total number of files requested to move'),\n totalMoved: z.number().describe('Number of files successfully moved'),\n totalFailed: z.number().describe('Number of files that failed to move'),\n});\n\n// Output schema with auth_required support\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n title: 'Move Files',\n description: 'Move files/folders to destination folder. Returns oldParents for undo. Use \"root\" for My Drive root.',\n inputSchema: inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\n/**\n * Move a single file to a new parent folder\n */\nasync function moveSingleFile(\n drive: drive_v3.Drive,\n fileId: string,\n destinationFolderId: string,\n returnOldParents: boolean,\n logger: Logger\n): Promise<{\n success: boolean;\n result?: MoveResult;\n error?: FailedMove;\n}> {\n try {\n // Get current file metadata to get old parents\n const fileMetadata = await drive.files.get({\n fileId: fileId,\n fields: 'id,name,parents,webViewLink',\n });\n\n const oldParents = (fileMetadata.data.parents as string[] | undefined) || [];\n const fileName = (fileMetadata.data.name as string | undefined) || fileId;\n const webViewLink = fileMetadata.data.webViewLink as string | undefined;\n\n // Move file using addParents and removeParents\n await drive.files.update({\n fileId: fileId,\n addParents: destinationFolderId,\n removeParents: oldParents.join(','),\n fields: 'id,name,parents,webViewLink',\n });\n\n const result: MoveResult = {\n fileId: fileId,\n fileName: fileName,\n oldParents: returnOldParents ? oldParents : [],\n newParent: destinationFolderId,\n ...(webViewLink && { webViewLink }),\n };\n\n return { success: true, result };\n } catch (e: unknown) {\n const errorMessage = isDriveApiError(e) && e.message ? e.message : 'Unknown error';\n const errorCode = isDriveApiError(e) && e.code ? String(e.code) : undefined;\n logger.info('Failed to move file', { fileId, error: errorMessage });\n return {\n success: false,\n error: {\n fileId: fileId,\n error: errorMessage,\n ...(errorCode && { code: errorCode }),\n },\n };\n }\n}\n\n/**\n * Move multiple files using batch requests\n */\nasync function moveBatchFiles(\n drive: drive_v3.Drive,\n fileIds: string[],\n destinationFolderId: string,\n returnOldParents: boolean,\n _logger: Logger\n): Promise<{\n moved: MoveResult[];\n failed: FailedMove[];\n}> {\n const moved: MoveResult[] = [];\n const failed: FailedMove[] = [];\n\n // First, fetch metadata for all files in batch\n const metadataResults = await Promise.allSettled(\n fileIds.map(async (fileId) => {\n try {\n const response = await drive.files.get({\n fileId: fileId,\n fields: 'id,name,parents,webViewLink',\n });\n const webViewLink = response.data.webViewLink as string | undefined;\n return {\n fileId: fileId,\n name: (response.data.name as string | undefined) || fileId,\n parents: (response.data.parents as string[] | undefined) || [],\n ...(webViewLink && { webViewLink }),\n };\n } catch (e: unknown) {\n const message = isDriveApiError(e) && e.message ? e.message : String(e);\n throw new Error(`Failed to fetch metadata: ${message}`);\n }\n })\n );\n\n // Process metadata results\n const filesToMove: Array<{\n fileId: string;\n name: string;\n parents: string[];\n webViewLink?: string;\n }> = [];\n for (let i = 0; i < metadataResults.length; i++) {\n const result = metadataResults[i];\n if (result && result.status === 'fulfilled') {\n filesToMove.push(result.value);\n } else if (result && result.status === 'rejected') {\n const fileId = fileIds[i];\n if (fileId) {\n const errorCode = result.reason?.code ? String(result.reason.code) : undefined;\n failed.push({\n fileId: fileId,\n error: result.reason?.message || 'Failed to fetch file metadata',\n ...(errorCode && { code: errorCode }),\n });\n }\n }\n }\n\n // Now move files in batch\n const moveResults = await Promise.allSettled(\n filesToMove.map(async (file) => {\n try {\n await drive.files.update({\n fileId: file.fileId,\n addParents: destinationFolderId,\n removeParents: file.parents.join(','),\n fields: 'id',\n });\n return {\n fileId: file.fileId,\n fileName: file.name,\n oldParents: returnOldParents ? file.parents : [],\n newParent: destinationFolderId,\n ...(file.webViewLink && { webViewLink: file.webViewLink }),\n };\n } catch (e: unknown) {\n const message = isDriveApiError(e) && e.message ? e.message : String(e);\n throw new Error(`Failed to move: ${message}`);\n }\n })\n );\n\n // Process move results\n for (let i = 0; i < moveResults.length; i++) {\n const result = moveResults[i];\n if (result && result.status === 'fulfilled') {\n moved.push(result.value);\n } else if (result && result.status === 'rejected') {\n const file = filesToMove[i];\n if (file) {\n const errorCode = result.reason?.code ? String(result.reason.code) : undefined;\n failed.push({\n fileId: file.fileId,\n error: result.reason?.message || 'Failed to move file',\n ...(errorCode && { code: errorCode }),\n });\n }\n }\n }\n\n return { moved, failed };\n}\n\nasync function handler({ fileIds, destinationFolderId, returnOldParents = true }: Input, extra: EnrichedExtra): Promise<CallToolResult> {\n const logger = extra.logger;\n const isBatch = Array.isArray(fileIds);\n const fileIdArray = Array.isArray(fileIds) ? fileIds : [fileIds];\n\n logger.info('drive.file.move called', {\n fileCount: fileIdArray.length,\n isBatch,\n destinationFolderId,\n returnOldParents,\n });\n\n try {\n const drive = google.drive({ version: 'v3', auth: extra.authContext.auth });\n\n let moved: MoveResult[] = [];\n let failed: FailedMove[] = [];\n\n if (isBatch && fileIdArray.length > 1) {\n // Use batch API for multiple files\n const batchResult = await moveBatchFiles(drive, fileIdArray, destinationFolderId, returnOldParents, logger);\n moved = batchResult.moved;\n failed = batchResult.failed;\n } else {\n // Single file operation\n const fileId = fileIdArray[0];\n if (fileId) {\n const singleResult = await moveSingleFile(drive, fileId, destinationFolderId, returnOldParents, logger);\n if (singleResult.success && singleResult.result) {\n moved.push(singleResult.result);\n } else if (singleResult.error) {\n failed.push(singleResult.error);\n }\n }\n }\n\n logger.info('drive.file.move returning', {\n totalRequested: fileIdArray.length,\n totalMoved: moved.length,\n totalFailed: failed.length,\n });\n\n const result: Output = {\n type: 'success' as const,\n moved,\n ...(failed.length > 0 && { failed }),\n totalRequested: fileIdArray.length,\n totalMoved: moved.length,\n totalFailed: failed.length,\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('drive.file.move error', { error: message });\n\n // Throw McpError\n throw new McpError(ErrorCode.InternalError, `Error moving files: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'file-move' as const,\n config,\n handler,\n };\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","isDriveApiError","error","inputSchema","z","object","fileIds","union","string","min","array","max","describe","destinationFolderId","returnOldParents","boolean","optional","successBranchSchema","type","literal","moved","fileId","fileName","oldParents","newParent","webViewLink","failed","code","totalRequested","number","totalMoved","totalFailed","outputSchema","discriminatedUnion","config","title","description","result","moveSingleFile","drive","logger","fileMetadata","e","errorMessage","errorCode","files","get","fields","data","parents","name","update","addParents","removeParents","join","success","message","String","undefined","info","moveBatchFiles","_logger","metadataResults","filesToMove","i","moveResults","file","Promise","allSettled","map","response","Error","length","status","push","value","reason","handler","extra","isBatch","fileIdArray","batchResult","singleResult","Array","isArray","fileCount","google","version","auth","authContext","content","text","JSON","stringify","structuredContent","McpError","ErrorCode","InternalError","stack"],"mappings":";;;;+BAiUA;;;eAAwBA;;;2BAhUA;qBAIiC;0BAElC;mBACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BACIM,OAAO8C,MAAM,GAAG,KAAK;wBAAE9C,QAAAA;oBAAO;wBAClCE,gBAAgBoD,YAAYR,MAAM;wBAClC1C,YAAYV,MAAMoD,MAAM;wBACxBzC,aAAaL,OAAO8C,MAAM;;oBAG5B;;wBAAO;4BACLkB,OAAO;gCACL;oCACExE,MAAM;oCACNyE,MAAMC,KAAKC,SAAS,CAACxD;gCACvB;;4BAEFyD,mBAAmB;gCAAEzD,QAAAA;4BAAO;wBAC9B;;;oBACOnC;oBACDsD,UAAUtD,AAAK,YAALA,OAAiBqE,SAAQrE,MAAMsD,OAAO,GAAGC,OAAOvD;oBAChEsC,OAAOtC,KAAK,CAAC,yBAAyB;wBAAEA,OAAOsD;oBAAQ;oBAEvD,iBAAiB;oBACjB,MAAM,IAAIuC,eAAQ,CAACC,gBAAS,CAACC,aAAa,EAAE,AAAC,uBAA8B,OAARzC,UAAW;wBAC5E0C,OAAOhG,AAAK,YAALA,OAAiBqE,SAAQrE,MAAMgG,KAAK,GAAGxC;oBAChD;;;;;;;IAEJ;;AAEe,SAAS5D;IACtB,OAAO;QACLoD,MAAM;QACNhB,QAAAA;QACA2C,SAAAA;IACF;AACF"}
@@ -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 {};