mcp-google-multi 5.3.0 → 5.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/accounts.js +3 -8
- package/dist/auth.d.ts +1 -4
- package/dist/auth.js +6 -18
- package/dist/client.d.ts +2 -1
- package/dist/client.js +2 -2
- package/dist/executor.js +1 -5
- package/dist/services.js +2 -4
- package/dist/token-store.js +3 -8
- package/dist/tools/admin.d.ts +0 -6
- package/dist/tools/admin.js +8 -13
- package/dist/tools/calendar.js +12 -12
- package/dist/tools/chat.js +5 -5
- package/dist/tools/contacts.js +10 -10
- package/dist/tools/docs.js +28 -28
- package/dist/tools/drive.js +39 -41
- package/dist/tools/forms.js +8 -8
- package/dist/tools/gmail-mime.d.ts +7 -27
- package/dist/tools/gmail-mime.js +10 -36
- package/dist/tools/gmail.js +22 -22
- package/dist/tools/meet.js +6 -6
- package/dist/tools/searchconsole.js +12 -11
- package/dist/tools/sheets.js +30 -30
- package/dist/tools/slides.js +6 -6
- package/dist/tools/tasks.js +13 -13
- package/package.json +16 -2
package/dist/tools/docs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { coerceBoolean, coerceJson } from './_coerce.js';
|
|
3
|
-
import {
|
|
3
|
+
import { docs as docsClient } from '@googleapis/docs';
|
|
4
4
|
import { ACCOUNTS } from '../accounts.js';
|
|
5
5
|
import { getClient } from '../client.js';
|
|
6
6
|
import { handleGoogleApiError } from './_errors.js';
|
|
@@ -137,7 +137,7 @@ export function registerDocsTools(server) {
|
|
|
137
137
|
}, async ({ account, title }) => {
|
|
138
138
|
try {
|
|
139
139
|
const auth = await getClient(account);
|
|
140
|
-
const docs =
|
|
140
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
141
141
|
const res = await docs.documents.create({
|
|
142
142
|
requestBody: { title },
|
|
143
143
|
});
|
|
@@ -169,7 +169,7 @@ export function registerDocsTools(server) {
|
|
|
169
169
|
}, async ({ account, documentId, includeTabsContent, suggestionsViewMode }) => {
|
|
170
170
|
try {
|
|
171
171
|
const auth = await getClient(account);
|
|
172
|
-
const docs =
|
|
172
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
173
173
|
const res = await docs.documents.get({
|
|
174
174
|
documentId,
|
|
175
175
|
includeTabsContent: includeTabsContent ?? false,
|
|
@@ -217,7 +217,7 @@ export function registerDocsTools(server) {
|
|
|
217
217
|
};
|
|
218
218
|
}
|
|
219
219
|
const auth = await getClient(account);
|
|
220
|
-
const docs =
|
|
220
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
221
221
|
const res = await docs.documents.get({
|
|
222
222
|
documentId,
|
|
223
223
|
...(tabId !== undefined ? { includeTabsContent: true } : {}),
|
|
@@ -303,7 +303,7 @@ export function registerDocsTools(server) {
|
|
|
303
303
|
}, async ({ account, documentId, text, index }) => {
|
|
304
304
|
try {
|
|
305
305
|
const auth = await getClient(account);
|
|
306
|
-
const docs =
|
|
306
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
307
307
|
const request = { insertText: { text } };
|
|
308
308
|
if (index !== undefined) {
|
|
309
309
|
request.insertText.location = { index };
|
|
@@ -339,7 +339,7 @@ export function registerDocsTools(server) {
|
|
|
339
339
|
}, async ({ account, documentId, findText, replaceText, matchCase }) => {
|
|
340
340
|
try {
|
|
341
341
|
const auth = await getClient(account);
|
|
342
|
-
const docs =
|
|
342
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
343
343
|
const res = await docs.documents.batchUpdate({
|
|
344
344
|
documentId,
|
|
345
345
|
requestBody: {
|
|
@@ -374,7 +374,7 @@ export function registerDocsTools(server) {
|
|
|
374
374
|
}, async ({ account, documentId, startIndex, endIndex }) => {
|
|
375
375
|
try {
|
|
376
376
|
const auth = await getClient(account);
|
|
377
|
-
const docs =
|
|
377
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
378
378
|
const res = await docs.documents.batchUpdate({
|
|
379
379
|
documentId,
|
|
380
380
|
requestBody: {
|
|
@@ -412,7 +412,7 @@ export function registerDocsTools(server) {
|
|
|
412
412
|
}, async ({ account, documentId, startIndex, endIndex, bold, italic, underline, fontSize, fontFamily }) => {
|
|
413
413
|
try {
|
|
414
414
|
const auth = await getClient(account);
|
|
415
|
-
const docs =
|
|
415
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
416
416
|
const textStyle = {};
|
|
417
417
|
const fields = [];
|
|
418
418
|
if (bold !== undefined) {
|
|
@@ -480,7 +480,7 @@ export function registerDocsTools(server) {
|
|
|
480
480
|
}, async ({ account, documentId, rows, columns, index }) => {
|
|
481
481
|
try {
|
|
482
482
|
const auth = await getClient(account);
|
|
483
|
-
const docs =
|
|
483
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
484
484
|
const request = { insertTable: { rows, columns } };
|
|
485
485
|
if (index !== undefined) {
|
|
486
486
|
request.insertTable.location = { index };
|
|
@@ -516,7 +516,7 @@ export function registerDocsTools(server) {
|
|
|
516
516
|
}, async ({ account, documentId, name, startIndex, endIndex }) => {
|
|
517
517
|
try {
|
|
518
518
|
const auth = await getClient(account);
|
|
519
|
-
const docs =
|
|
519
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
520
520
|
const res = await docs.documents.batchUpdate({
|
|
521
521
|
documentId,
|
|
522
522
|
requestBody: {
|
|
@@ -551,7 +551,7 @@ export function registerDocsTools(server) {
|
|
|
551
551
|
return { content: [{ type: 'text', text: JSON.stringify({ error: 'Either namedRangeId or name must be supplied' }) }], isError: true };
|
|
552
552
|
}
|
|
553
553
|
const auth = await getClient(account);
|
|
554
|
-
const docs =
|
|
554
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
555
555
|
const req = {};
|
|
556
556
|
if (namedRangeId)
|
|
557
557
|
req.namedRangeId = namedRangeId;
|
|
@@ -584,7 +584,7 @@ export function registerDocsTools(server) {
|
|
|
584
584
|
return { content: [{ type: 'text', text: JSON.stringify({ error: 'Either namedRangeId or namedRangeName must be supplied' }) }], isError: true };
|
|
585
585
|
}
|
|
586
586
|
const auth = await getClient(account);
|
|
587
|
-
const docs =
|
|
587
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
588
588
|
const req = { text };
|
|
589
589
|
if (namedRangeId)
|
|
590
590
|
req.namedRangeId = namedRangeId;
|
|
@@ -629,7 +629,7 @@ export function registerDocsTools(server) {
|
|
|
629
629
|
}, async ({ account, documentId, startIndex, endIndex, ...style }) => {
|
|
630
630
|
try {
|
|
631
631
|
const auth = await getClient(account);
|
|
632
|
-
const docs =
|
|
632
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
633
633
|
const built = buildParagraphStyle(style);
|
|
634
634
|
if (built.fields.length === 0) {
|
|
635
635
|
return { content: [{ type: 'text', text: JSON.stringify({ error: 'No paragraph style properties supplied' }) }], isError: true };
|
|
@@ -675,7 +675,7 @@ export function registerDocsTools(server) {
|
|
|
675
675
|
}, async ({ account, documentId, ...style }) => {
|
|
676
676
|
try {
|
|
677
677
|
const auth = await getClient(account);
|
|
678
|
-
const docs =
|
|
678
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
679
679
|
const built = buildDocumentStyle(style);
|
|
680
680
|
if (built.fields.length === 0) {
|
|
681
681
|
return { content: [{ type: 'text', text: JSON.stringify({ error: 'No document style properties supplied' }) }], isError: true };
|
|
@@ -728,7 +728,7 @@ export function registerDocsTools(server) {
|
|
|
728
728
|
}, async ({ account, documentId, startIndex, endIndex, bulletPreset }) => {
|
|
729
729
|
try {
|
|
730
730
|
const auth = await getClient(account);
|
|
731
|
-
const docs =
|
|
731
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
732
732
|
await docs.documents.batchUpdate({
|
|
733
733
|
documentId,
|
|
734
734
|
requestBody: {
|
|
@@ -759,7 +759,7 @@ export function registerDocsTools(server) {
|
|
|
759
759
|
}, async ({ account, documentId, startIndex, endIndex }) => {
|
|
760
760
|
try {
|
|
761
761
|
const auth = await getClient(account);
|
|
762
|
-
const docs =
|
|
762
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
763
763
|
await docs.documents.batchUpdate({
|
|
764
764
|
documentId,
|
|
765
765
|
requestBody: {
|
|
@@ -792,7 +792,7 @@ export function registerDocsTools(server) {
|
|
|
792
792
|
}, async ({ account, documentId, uri, index, width, height }) => {
|
|
793
793
|
try {
|
|
794
794
|
const auth = await getClient(account);
|
|
795
|
-
const docs =
|
|
795
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
796
796
|
const request = { uri };
|
|
797
797
|
if (index !== undefined)
|
|
798
798
|
request.location = { index };
|
|
@@ -828,7 +828,7 @@ export function registerDocsTools(server) {
|
|
|
828
828
|
}, async ({ account, documentId, index }) => {
|
|
829
829
|
try {
|
|
830
830
|
const auth = await getClient(account);
|
|
831
|
-
const docs =
|
|
831
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
832
832
|
const request = {};
|
|
833
833
|
if (index !== undefined)
|
|
834
834
|
request.location = { index };
|
|
@@ -857,7 +857,7 @@ export function registerDocsTools(server) {
|
|
|
857
857
|
}, async ({ account, documentId, index, sectionType }) => {
|
|
858
858
|
try {
|
|
859
859
|
const auth = await getClient(account);
|
|
860
|
-
const docs =
|
|
860
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
861
861
|
const request = { sectionType: sectionType ?? 'NEXT_PAGE' };
|
|
862
862
|
if (index !== undefined)
|
|
863
863
|
request.location = { index };
|
|
@@ -886,7 +886,7 @@ export function registerDocsTools(server) {
|
|
|
886
886
|
}, async ({ account, documentId, sectionBreakIndex }) => {
|
|
887
887
|
try {
|
|
888
888
|
const auth = await getClient(account);
|
|
889
|
-
const docs =
|
|
889
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
890
890
|
const request = { type: 'DEFAULT' };
|
|
891
891
|
if (sectionBreakIndex !== undefined)
|
|
892
892
|
request.sectionBreakLocation = { index: sectionBreakIndex };
|
|
@@ -913,7 +913,7 @@ export function registerDocsTools(server) {
|
|
|
913
913
|
}, async ({ account, documentId, headerId }) => {
|
|
914
914
|
try {
|
|
915
915
|
const auth = await getClient(account);
|
|
916
|
-
const docs =
|
|
916
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
917
917
|
await docs.documents.batchUpdate({
|
|
918
918
|
documentId,
|
|
919
919
|
requestBody: { requests: [{ deleteHeader: { headerId } }] },
|
|
@@ -936,7 +936,7 @@ export function registerDocsTools(server) {
|
|
|
936
936
|
}, async ({ account, documentId, sectionBreakIndex }) => {
|
|
937
937
|
try {
|
|
938
938
|
const auth = await getClient(account);
|
|
939
|
-
const docs =
|
|
939
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
940
940
|
const request = { type: 'DEFAULT' };
|
|
941
941
|
if (sectionBreakIndex !== undefined)
|
|
942
942
|
request.sectionBreakLocation = { index: sectionBreakIndex };
|
|
@@ -963,7 +963,7 @@ export function registerDocsTools(server) {
|
|
|
963
963
|
}, async ({ account, documentId, footerId }) => {
|
|
964
964
|
try {
|
|
965
965
|
const auth = await getClient(account);
|
|
966
|
-
const docs =
|
|
966
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
967
967
|
await docs.documents.batchUpdate({
|
|
968
968
|
documentId,
|
|
969
969
|
requestBody: { requests: [{ deleteFooter: { footerId } }] },
|
|
@@ -994,7 +994,7 @@ export function registerDocsTools(server) {
|
|
|
994
994
|
}, async ({ account, documentId, operation, tableStartIndex, rowIndex, columnIndex, insertBelow, insertRight, rowSpan, columnSpan }) => {
|
|
995
995
|
try {
|
|
996
996
|
const auth = await getClient(account);
|
|
997
|
-
const docs =
|
|
997
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
998
998
|
const cellLoc = {
|
|
999
999
|
tableStartLocation: { index: tableStartIndex },
|
|
1000
1000
|
rowIndex,
|
|
@@ -1062,7 +1062,7 @@ export function registerDocsTools(server) {
|
|
|
1062
1062
|
}, async ({ account, documentId, title, parentTabId, index }) => {
|
|
1063
1063
|
try {
|
|
1064
1064
|
const auth = await getClient(account);
|
|
1065
|
-
const docs =
|
|
1065
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
1066
1066
|
const tabProperties = { title };
|
|
1067
1067
|
if (parentTabId)
|
|
1068
1068
|
tabProperties.parentTabId = parentTabId;
|
|
@@ -1091,7 +1091,7 @@ export function registerDocsTools(server) {
|
|
|
1091
1091
|
}, async ({ account, documentId, tabId }) => {
|
|
1092
1092
|
try {
|
|
1093
1093
|
const auth = await getClient(account);
|
|
1094
|
-
const docs =
|
|
1094
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
1095
1095
|
await docs.documents.batchUpdate({
|
|
1096
1096
|
documentId,
|
|
1097
1097
|
requestBody: { requests: [{ deleteTab: { tabId } }] },
|
|
@@ -1117,7 +1117,7 @@ export function registerDocsTools(server) {
|
|
|
1117
1117
|
}, async ({ account, documentId, tabId, title, index, parentTabId }) => {
|
|
1118
1118
|
try {
|
|
1119
1119
|
const auth = await getClient(account);
|
|
1120
|
-
const docs =
|
|
1120
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
1121
1121
|
const tabProperties = { tabId };
|
|
1122
1122
|
const fields = [];
|
|
1123
1123
|
if (title !== undefined) {
|
|
@@ -1169,7 +1169,7 @@ export function registerDocsTools(server) {
|
|
|
1169
1169
|
}, async ({ account, documentId, requests, writeControl }) => {
|
|
1170
1170
|
try {
|
|
1171
1171
|
const auth = await getClient(account);
|
|
1172
|
-
const docs =
|
|
1172
|
+
const docs = docsClient({ version: 'v1', auth });
|
|
1173
1173
|
const res = await docs.documents.batchUpdate({
|
|
1174
1174
|
documentId,
|
|
1175
1175
|
requestBody: {
|
package/dist/tools/drive.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { coerceArray, coerceBoolean } from './_coerce.js';
|
|
3
|
-
import {
|
|
3
|
+
import { drive as driveClient } from '@googleapis/drive';
|
|
4
4
|
import { ACCOUNTS, ACCOUNT_CONFIG } from '../accounts.js';
|
|
5
5
|
import { getClient } from '../client.js';
|
|
6
6
|
import { handleGoogleApiError } from './_errors.js';
|
|
@@ -28,9 +28,7 @@ const COMMENT_FIELDS = `${COMMENT_BASE_FIELDS},replies(${REPLY_SUBFIELDS})`;
|
|
|
28
28
|
const COMMENT_LIST_FIELDS = `nextPageToken,comments(${COMMENT_BASE_FIELDS},replies(${REPLY_SUBFIELDS}))`;
|
|
29
29
|
const REPLY_FIELDS = `kind,htmlContent,${REPLY_SUBFIELDS}`;
|
|
30
30
|
const REPLY_LIST_FIELDS = `nextPageToken,replies(${REPLY_FIELDS})`;
|
|
31
|
-
// basename
|
|
32
|
-
// directory if missing (callers otherwise hit ENOENT on a non-existent savePath), and
|
|
33
|
-
// return the absolute path to write.
|
|
31
|
+
// path.basename() is a traversal guard — a caller-supplied filename must never escape savePath.
|
|
34
32
|
export function prepareLocalDest(savePath, filename) {
|
|
35
33
|
const dest = path.join(savePath, path.basename(filename));
|
|
36
34
|
fs.mkdirSync(savePath, { recursive: true });
|
|
@@ -59,7 +57,7 @@ export function registerDriveTools(server) {
|
|
|
59
57
|
}, async ({ account, query, maxResults, driveId }) => {
|
|
60
58
|
try {
|
|
61
59
|
const auth = await getClient(account);
|
|
62
|
-
const drive =
|
|
60
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
63
61
|
const params = {
|
|
64
62
|
q: query,
|
|
65
63
|
pageSize: maxResults ?? 20,
|
|
@@ -93,7 +91,7 @@ export function registerDriveTools(server) {
|
|
|
93
91
|
}, async ({ account, fileId, maxChars, offset }) => {
|
|
94
92
|
try {
|
|
95
93
|
const auth = await getClient(account);
|
|
96
|
-
const drive =
|
|
94
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
97
95
|
const meta = await drive.files.get({
|
|
98
96
|
fileId,
|
|
99
97
|
fields: 'id,name,mimeType,size,webViewLink',
|
|
@@ -186,7 +184,7 @@ export function registerDriveTools(server) {
|
|
|
186
184
|
}, async ({ account, folderId, maxResults }) => {
|
|
187
185
|
try {
|
|
188
186
|
const auth = await getClient(account);
|
|
189
|
-
const drive =
|
|
187
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
190
188
|
// Escape single quotes per Drive query syntax to prevent breaking out of the literal.
|
|
191
189
|
const parent = (folderId ?? 'root').replace(/\\/g, '\\\\').replace(/'/g, "\\'");
|
|
192
190
|
const res = await drive.files.list({
|
|
@@ -223,7 +221,7 @@ export function registerDriveTools(server) {
|
|
|
223
221
|
}, async ({ account, localPath, filename, mimeType: mimeTypeArg, convertTo, parentFolderId }) => {
|
|
224
222
|
try {
|
|
225
223
|
const auth = await getClient(account);
|
|
226
|
-
const drive =
|
|
224
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
227
225
|
const resolvedMime = mimeTypeArg ?? (mime.lookup(localPath) || 'application/octet-stream');
|
|
228
226
|
const fileStream = fs.createReadStream(localPath);
|
|
229
227
|
const res = await drive.files.create({
|
|
@@ -259,7 +257,7 @@ export function registerDriveTools(server) {
|
|
|
259
257
|
}, async ({ account, fileId, savePath, filename }) => {
|
|
260
258
|
try {
|
|
261
259
|
const auth = await getClient(account);
|
|
262
|
-
const drive =
|
|
260
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
263
261
|
const dest = prepareLocalDest(savePath, filename);
|
|
264
262
|
const res = await drive.files.get({ fileId, alt: 'media', supportsAllDrives: true }, { responseType: 'stream' });
|
|
265
263
|
// pipeline destroys both streams on source/sink error; raw .pipe leaks the partial file.
|
|
@@ -285,7 +283,7 @@ export function registerDriveTools(server) {
|
|
|
285
283
|
}, async ({ account, fileId, mimeType: exportMime, savePath, filename }) => {
|
|
286
284
|
try {
|
|
287
285
|
const auth = await getClient(account);
|
|
288
|
-
const drive =
|
|
286
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
289
287
|
const dest = prepareLocalDest(savePath, filename);
|
|
290
288
|
const res = await drive.files.export({ fileId, mimeType: exportMime }, { responseType: 'stream' });
|
|
291
289
|
// pipeline destroys both streams on source/sink error; raw .pipe leaks the partial file.
|
|
@@ -309,7 +307,7 @@ export function registerDriveTools(server) {
|
|
|
309
307
|
}, async ({ account, name, parentFolderId }) => {
|
|
310
308
|
try {
|
|
311
309
|
const auth = await getClient(account);
|
|
312
|
-
const drive =
|
|
310
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
313
311
|
const res = await drive.files.create({
|
|
314
312
|
requestBody: {
|
|
315
313
|
name,
|
|
@@ -346,7 +344,7 @@ export function registerDriveTools(server) {
|
|
|
346
344
|
}, async ({ account, fileId, newName, newParentFolderId, localPath: localPathArg, mimeType: mimeTypeArg, convertTo }) => {
|
|
347
345
|
try {
|
|
348
346
|
const auth = await getClient(account);
|
|
349
|
-
const drive =
|
|
347
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
350
348
|
const requestBody = {};
|
|
351
349
|
if (newName)
|
|
352
350
|
requestBody.name = newName;
|
|
@@ -388,7 +386,7 @@ export function registerDriveTools(server) {
|
|
|
388
386
|
}, async ({ account, fileId }) => {
|
|
389
387
|
try {
|
|
390
388
|
const auth = await getClient(account);
|
|
391
|
-
const drive =
|
|
389
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
392
390
|
await drive.files.delete({ fileId, supportsAllDrives: true });
|
|
393
391
|
return {
|
|
394
392
|
content: [{ type: 'text', text: JSON.stringify({ deleted: true, fileId }, null, 2) }],
|
|
@@ -407,7 +405,7 @@ export function registerDriveTools(server) {
|
|
|
407
405
|
}, async ({ account, fileId }) => {
|
|
408
406
|
try {
|
|
409
407
|
const auth = await getClient(account);
|
|
410
|
-
const drive =
|
|
408
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
411
409
|
await drive.files.update({
|
|
412
410
|
fileId,
|
|
413
411
|
requestBody: { trashed: true },
|
|
@@ -430,7 +428,7 @@ export function registerDriveTools(server) {
|
|
|
430
428
|
}, async ({ account, fileId }) => {
|
|
431
429
|
try {
|
|
432
430
|
const auth = await getClient(account);
|
|
433
|
-
const drive =
|
|
431
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
434
432
|
const res = await drive.files.update({
|
|
435
433
|
fileId,
|
|
436
434
|
requestBody: { trashed: false },
|
|
@@ -453,7 +451,7 @@ export function registerDriveTools(server) {
|
|
|
453
451
|
}, async ({ account }) => {
|
|
454
452
|
try {
|
|
455
453
|
const auth = await getClient(account);
|
|
456
|
-
const drive =
|
|
454
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
457
455
|
await drive.files.emptyTrash({});
|
|
458
456
|
return {
|
|
459
457
|
content: [{ type: 'text', text: JSON.stringify({ emptied: true }, null, 2) }],
|
|
@@ -475,7 +473,7 @@ export function registerDriveTools(server) {
|
|
|
475
473
|
}, async ({ account, fileId, newName, parentFolderId }) => {
|
|
476
474
|
try {
|
|
477
475
|
const auth = await getClient(account);
|
|
478
|
-
const drive =
|
|
476
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
479
477
|
const res = await drive.files.copy({
|
|
480
478
|
fileId,
|
|
481
479
|
requestBody: {
|
|
@@ -503,7 +501,7 @@ export function registerDriveTools(server) {
|
|
|
503
501
|
}, async ({ account, fileId, newParentFolderId }) => {
|
|
504
502
|
try {
|
|
505
503
|
const auth = await getClient(account);
|
|
506
|
-
const drive =
|
|
504
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
507
505
|
const current = await drive.files.get({ fileId, fields: 'parents', supportsAllDrives: true });
|
|
508
506
|
const res = await drive.files.update({
|
|
509
507
|
fileId,
|
|
@@ -538,7 +536,7 @@ export function registerDriveTools(server) {
|
|
|
538
536
|
}, async ({ account, fileId, type, role, emailAddress, domain, sendNotification, emailMessage, transferOwnership, expirationTime }) => {
|
|
539
537
|
try {
|
|
540
538
|
const auth = await getClient(account);
|
|
541
|
-
const drive =
|
|
539
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
542
540
|
const requestBody = { type, role, emailAddress, domain };
|
|
543
541
|
if (expirationTime)
|
|
544
542
|
requestBody.expirationTime = expirationTime;
|
|
@@ -569,7 +567,7 @@ export function registerDriveTools(server) {
|
|
|
569
567
|
}, async ({ account, fileId }) => {
|
|
570
568
|
try {
|
|
571
569
|
const auth = await getClient(account);
|
|
572
|
-
const drive =
|
|
570
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
573
571
|
const res = await drive.permissions.list({
|
|
574
572
|
fileId,
|
|
575
573
|
fields: 'permissions(id,type,role,emailAddress,domain,displayName,expirationTime)',
|
|
@@ -601,7 +599,7 @@ export function registerDriveTools(server) {
|
|
|
601
599
|
}, async ({ account, fileId, permissionId, role, expirationTime, removeExpiration, transferOwnership }) => {
|
|
602
600
|
try {
|
|
603
601
|
const auth = await getClient(account);
|
|
604
|
-
const drive =
|
|
602
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
605
603
|
const requestBody = {};
|
|
606
604
|
if (role)
|
|
607
605
|
requestBody.role = role;
|
|
@@ -634,7 +632,7 @@ export function registerDriveTools(server) {
|
|
|
634
632
|
}, async ({ account, fileId, permissionId }) => {
|
|
635
633
|
try {
|
|
636
634
|
const auth = await getClient(account);
|
|
637
|
-
const drive =
|
|
635
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
638
636
|
await drive.permissions.delete({ fileId, permissionId, supportsAllDrives: true });
|
|
639
637
|
return {
|
|
640
638
|
content: [{ type: 'text', text: JSON.stringify({ removed: true, permissionId }, null, 2) }],
|
|
@@ -660,7 +658,7 @@ export function registerDriveTools(server) {
|
|
|
660
658
|
}, async ({ account, fileId, content, anchor, quotedFileContent }) => {
|
|
661
659
|
try {
|
|
662
660
|
const auth = await getClient(account);
|
|
663
|
-
const drive =
|
|
661
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
664
662
|
const requestBody = { content };
|
|
665
663
|
if (anchor)
|
|
666
664
|
requestBody.anchor = anchor;
|
|
@@ -692,7 +690,7 @@ export function registerDriveTools(server) {
|
|
|
692
690
|
}, async ({ account, fileId, includeDeleted, pageSize, pageToken, startModifiedTime }) => {
|
|
693
691
|
try {
|
|
694
692
|
const auth = await getClient(account);
|
|
695
|
-
const drive =
|
|
693
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
696
694
|
const res = await drive.comments.list({
|
|
697
695
|
fileId,
|
|
698
696
|
includeDeleted: includeDeleted ?? false,
|
|
@@ -720,7 +718,7 @@ export function registerDriveTools(server) {
|
|
|
720
718
|
}, async ({ account, fileId, commentId, includeDeleted }) => {
|
|
721
719
|
try {
|
|
722
720
|
const auth = await getClient(account);
|
|
723
|
-
const drive =
|
|
721
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
724
722
|
const res = await drive.comments.get({
|
|
725
723
|
fileId,
|
|
726
724
|
commentId,
|
|
@@ -746,7 +744,7 @@ export function registerDriveTools(server) {
|
|
|
746
744
|
}, async ({ account, fileId, commentId, content }) => {
|
|
747
745
|
try {
|
|
748
746
|
const auth = await getClient(account);
|
|
749
|
-
const drive =
|
|
747
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
750
748
|
const res = await drive.comments.update({
|
|
751
749
|
fileId,
|
|
752
750
|
commentId,
|
|
@@ -771,7 +769,7 @@ export function registerDriveTools(server) {
|
|
|
771
769
|
}, async ({ account, fileId, commentId }) => {
|
|
772
770
|
try {
|
|
773
771
|
const auth = await getClient(account);
|
|
774
|
-
const drive =
|
|
772
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
775
773
|
await drive.comments.delete({ fileId, commentId });
|
|
776
774
|
return {
|
|
777
775
|
content: [{ type: 'text', text: JSON.stringify({ deleted: true, commentId }, null, 2) }],
|
|
@@ -795,7 +793,7 @@ export function registerDriveTools(server) {
|
|
|
795
793
|
}, async ({ account, fileId, commentId, content, action }) => {
|
|
796
794
|
try {
|
|
797
795
|
const auth = await getClient(account);
|
|
798
|
-
const drive =
|
|
796
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
799
797
|
const requestBody = { content };
|
|
800
798
|
if (action)
|
|
801
799
|
requestBody.action = action;
|
|
@@ -826,7 +824,7 @@ export function registerDriveTools(server) {
|
|
|
826
824
|
}, async ({ account, fileId, commentId, includeDeleted, pageSize, pageToken }) => {
|
|
827
825
|
try {
|
|
828
826
|
const auth = await getClient(account);
|
|
829
|
-
const drive =
|
|
827
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
830
828
|
const res = await drive.replies.list({
|
|
831
829
|
fileId,
|
|
832
830
|
commentId,
|
|
@@ -855,7 +853,7 @@ export function registerDriveTools(server) {
|
|
|
855
853
|
}, async ({ account, fileId, commentId, replyId, content }) => {
|
|
856
854
|
try {
|
|
857
855
|
const auth = await getClient(account);
|
|
858
|
-
const drive =
|
|
856
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
859
857
|
const res = await drive.replies.update({
|
|
860
858
|
fileId,
|
|
861
859
|
commentId,
|
|
@@ -882,7 +880,7 @@ export function registerDriveTools(server) {
|
|
|
882
880
|
}, async ({ account, fileId, commentId, replyId }) => {
|
|
883
881
|
try {
|
|
884
882
|
const auth = await getClient(account);
|
|
885
|
-
const drive =
|
|
883
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
886
884
|
await drive.replies.delete({ fileId, commentId, replyId });
|
|
887
885
|
return {
|
|
888
886
|
content: [{ type: 'text', text: JSON.stringify({ deleted: true, replyId }, null, 2) }],
|
|
@@ -904,7 +902,7 @@ export function registerDriveTools(server) {
|
|
|
904
902
|
}, async ({ account, fileId, pageSize, pageToken }) => {
|
|
905
903
|
try {
|
|
906
904
|
const auth = await getClient(account);
|
|
907
|
-
const drive =
|
|
905
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
908
906
|
const res = await drive.revisions.list({
|
|
909
907
|
fileId,
|
|
910
908
|
pageSize: pageSize ?? 50,
|
|
@@ -933,7 +931,7 @@ export function registerDriveTools(server) {
|
|
|
933
931
|
}, async ({ account, fileId, revisionId, keepForever, published, publishAuto, publishedOutsideDomain }) => {
|
|
934
932
|
try {
|
|
935
933
|
const auth = await getClient(account);
|
|
936
|
-
const drive =
|
|
934
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
937
935
|
const requestBody = {};
|
|
938
936
|
if (keepForever !== undefined)
|
|
939
937
|
requestBody.keepForever = keepForever;
|
|
@@ -967,7 +965,7 @@ export function registerDriveTools(server) {
|
|
|
967
965
|
}, async ({ account, fileId, revisionId }) => {
|
|
968
966
|
try {
|
|
969
967
|
const auth = await getClient(account);
|
|
970
|
-
const drive =
|
|
968
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
971
969
|
await drive.revisions.delete({ fileId, revisionId });
|
|
972
970
|
return {
|
|
973
971
|
content: [{ type: 'text', text: JSON.stringify({ deleted: true, revisionId }, null, 2) }],
|
|
@@ -989,7 +987,7 @@ export function registerDriveTools(server) {
|
|
|
989
987
|
}, async ({ account, fileId, pageSize, pageToken }) => {
|
|
990
988
|
try {
|
|
991
989
|
const auth = await getClient(account);
|
|
992
|
-
const drive =
|
|
990
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
993
991
|
const res = await drive.accessproposals.list({
|
|
994
992
|
fileId,
|
|
995
993
|
pageSize: pageSize ?? 20,
|
|
@@ -1019,7 +1017,7 @@ export function registerDriveTools(server) {
|
|
|
1019
1017
|
}, async ({ account, fileId, proposalId, action, role, view, sendNotification }) => {
|
|
1020
1018
|
try {
|
|
1021
1019
|
const auth = await getClient(account);
|
|
1022
|
-
const drive =
|
|
1020
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
1023
1021
|
const requestBody = { action };
|
|
1024
1022
|
if (role)
|
|
1025
1023
|
requestBody.role = role;
|
|
@@ -1052,7 +1050,7 @@ export function registerDriveTools(server) {
|
|
|
1052
1050
|
}, async ({ account, pageSize, pageToken, q }) => {
|
|
1053
1051
|
try {
|
|
1054
1052
|
const auth = await getClient(account);
|
|
1055
|
-
const drive =
|
|
1053
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
1056
1054
|
const res = await drive.drives.list({
|
|
1057
1055
|
pageSize: pageSize ?? 50,
|
|
1058
1056
|
pageToken,
|
|
@@ -1076,7 +1074,7 @@ export function registerDriveTools(server) {
|
|
|
1076
1074
|
}, async ({ account, driveId }) => {
|
|
1077
1075
|
try {
|
|
1078
1076
|
const auth = await getClient(account);
|
|
1079
|
-
const drive =
|
|
1077
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
1080
1078
|
const res = await drive.drives.get({
|
|
1081
1079
|
driveId,
|
|
1082
1080
|
fields: 'id,name,colorRgb,createdTime,hidden,capabilities,restrictions',
|
|
@@ -1127,10 +1125,10 @@ export function registerDriveTools(server) {
|
|
|
1127
1125
|
let activeAccount = fromAccount;
|
|
1128
1126
|
try {
|
|
1129
1127
|
const sourceAuth = await getClient(fromAccount);
|
|
1130
|
-
const sourceDrive =
|
|
1128
|
+
const sourceDrive = driveClient({ version: 'v3', auth: sourceAuth });
|
|
1131
1129
|
activeAccount = toAccount;
|
|
1132
1130
|
const targetAuth = await getClient(toAccount);
|
|
1133
|
-
const targetDrive =
|
|
1131
|
+
const targetDrive = driveClient({ version: 'v3', auth: targetAuth });
|
|
1134
1132
|
activeAccount = fromAccount;
|
|
1135
1133
|
const meta = await sourceDrive.files.get({
|
|
1136
1134
|
fileId,
|
|
@@ -1226,7 +1224,7 @@ export function registerDriveTools(server) {
|
|
|
1226
1224
|
}, async ({ account }) => {
|
|
1227
1225
|
try {
|
|
1228
1226
|
const auth = await getClient(account);
|
|
1229
|
-
const drive =
|
|
1227
|
+
const drive = driveClient({ version: 'v3', auth });
|
|
1230
1228
|
const res = await drive.about.get({
|
|
1231
1229
|
fields: 'user,storageQuota',
|
|
1232
1230
|
});
|
package/dist/tools/forms.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { forms as formsClient } from '@googleapis/forms';
|
|
3
3
|
import { ACCOUNTS } from '../accounts.js';
|
|
4
4
|
import { getClient } from '../client.js';
|
|
5
5
|
import { handleGoogleApiError } from './_errors.js';
|
|
@@ -15,7 +15,7 @@ export function registerFormsTools(server) {
|
|
|
15
15
|
}, async ({ account, formId }) => {
|
|
16
16
|
try {
|
|
17
17
|
const auth = await getClient(account);
|
|
18
|
-
const forms =
|
|
18
|
+
const forms = formsClient({ version: 'v1', auth });
|
|
19
19
|
const res = await forms.forms.get({ formId });
|
|
20
20
|
return {
|
|
21
21
|
content: [{ type: 'text', text: JSON.stringify(res.data, null, 2) }],
|
|
@@ -37,7 +37,7 @@ export function registerFormsTools(server) {
|
|
|
37
37
|
}, async ({ account, formId, pageSize, pageToken, filter }) => {
|
|
38
38
|
try {
|
|
39
39
|
const auth = await getClient(account);
|
|
40
|
-
const forms =
|
|
40
|
+
const forms = formsClient({ version: 'v1', auth });
|
|
41
41
|
const res = await forms.forms.responses.list({
|
|
42
42
|
formId,
|
|
43
43
|
pageSize: pageSize ?? 100,
|
|
@@ -62,7 +62,7 @@ export function registerFormsTools(server) {
|
|
|
62
62
|
}, async ({ account, formId, responseId }) => {
|
|
63
63
|
try {
|
|
64
64
|
const auth = await getClient(account);
|
|
65
|
-
const forms =
|
|
65
|
+
const forms = formsClient({ version: 'v1', auth });
|
|
66
66
|
const res = await forms.forms.responses.get({ formId, responseId });
|
|
67
67
|
return {
|
|
68
68
|
content: [{ type: 'text', text: JSON.stringify(res.data, null, 2) }],
|
|
@@ -81,7 +81,7 @@ export function registerFormsTools(server) {
|
|
|
81
81
|
}, async ({ account, formId }) => {
|
|
82
82
|
try {
|
|
83
83
|
const auth = await getClient(account);
|
|
84
|
-
const forms =
|
|
84
|
+
const forms = formsClient({ version: 'v1', auth });
|
|
85
85
|
const res = await forms.forms.watches.list({ formId });
|
|
86
86
|
return {
|
|
87
87
|
content: [{ type: 'text', text: JSON.stringify(res.data, null, 2) }],
|
|
@@ -101,7 +101,7 @@ export function registerFormsTools(server) {
|
|
|
101
101
|
}, async ({ account, title, documentTitle }) => {
|
|
102
102
|
try {
|
|
103
103
|
const auth = await getClient(account);
|
|
104
|
-
const forms =
|
|
104
|
+
const forms = formsClient({ version: 'v1', auth });
|
|
105
105
|
const res = await forms.forms.create({
|
|
106
106
|
requestBody: { info: { title, documentTitle } },
|
|
107
107
|
});
|
|
@@ -134,7 +134,7 @@ export function registerFormsTools(server) {
|
|
|
134
134
|
}, async ({ account, formId, requests, includeFormInResponse, writeControl }) => {
|
|
135
135
|
try {
|
|
136
136
|
const auth = await getClient(account);
|
|
137
|
-
const forms =
|
|
137
|
+
const forms = formsClient({ version: 'v1', auth });
|
|
138
138
|
const res = await forms.forms.batchUpdate({
|
|
139
139
|
formId,
|
|
140
140
|
requestBody: {
|
|
@@ -162,7 +162,7 @@ export function registerFormsTools(server) {
|
|
|
162
162
|
}, async ({ account, formId, isPublished, isAcceptingResponses }) => {
|
|
163
163
|
try {
|
|
164
164
|
const auth = await getClient(account);
|
|
165
|
-
const forms =
|
|
165
|
+
const forms = formsClient({ version: 'v1', auth });
|
|
166
166
|
const updateMask = ['publishState.isPublished'];
|
|
167
167
|
if (isAcceptingResponses !== undefined)
|
|
168
168
|
updateMask.push('publishState.isAcceptingResponses');
|