@mindstone/mcp-server-google-workspace 0.5.3 → 0.5.4
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 +19 -1
- package/dist/file-read-context.d.ts +57 -0
- package/dist/file-read-context.js +36 -0
- package/dist/modules/calendar/service.js +97 -90
- package/dist/modules/comments/service.js +6 -6
- package/dist/modules/docs/service.js +15 -11
- package/dist/modules/docs/types.d.ts +4 -0
- package/dist/modules/drive/service.js +1 -17
- package/dist/modules/forms/service.js +4 -4
- package/dist/modules/gmail/services/attachment.js +3 -1
- package/dist/modules/gmail/services/base.js +3 -1
- package/dist/modules/gmail/services/draft.js +13 -1
- package/dist/modules/gmail/services/email.js +13 -4
- package/dist/modules/gmail/services/label.js +19 -1
- package/dist/modules/gmail/services/settings.js +7 -1
- package/dist/modules/sheets/service.js +18 -18
- package/dist/modules/slides/service.js +7 -7
- package/dist/modules/tasks/service.js +7 -7
- package/dist/services/base/BaseGoogleService.js +2 -2
- package/dist/services/chat/index.js +3 -0
- package/dist/services/contacts/index.js +8 -5
- package/dist/services/meet/index.js +3 -0
- package/dist/tools/calendar-handlers.js +7 -7
- package/dist/tools/chat-handlers.js +4 -4
- package/dist/tools/contacts-handlers.js +5 -5
- package/dist/tools/definitions/gmail.js +4 -0
- package/dist/tools/docs-handlers.js +14 -6
- package/dist/tools/drive-handlers.d.ts +2 -1
- package/dist/tools/drive-handlers.js +21 -16
- package/dist/tools/gmail-handlers.d.ts +6 -5
- package/dist/tools/gmail-handlers.js +39 -27
- package/dist/tools/meet-handlers.js +4 -4
- package/dist/tools/server.js +24 -10
- package/dist/tools/sheets-handlers.js +4 -4
- package/dist/tools/slides-handlers.js +4 -4
- package/dist/utils/apiError.d.ts +7 -3
- package/dist/utils/apiError.js +37 -16
- package/dist/utils/google-retry.d.ts +15 -0
- package/dist/utils/google-retry.js +108 -0
- package/dist/utils/request-timeout.js +2 -0
- package/dist/utils/untrusted-content.d.ts +9 -0
- package/dist/utils/untrusted-content.js +37 -0
- package/package.json +3 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GmailError } from '../types.js';
|
|
2
2
|
import { buildMimeMessage } from './mime-builder.js';
|
|
3
|
-
import { describeApiError } from '../../../utils/apiError.js';
|
|
3
|
+
import { describeApiError, isPassthroughGoogleError } from '../../../utils/apiError.js';
|
|
4
4
|
import logger from '../../../utils/logger.js';
|
|
5
5
|
export class DraftService {
|
|
6
6
|
attachmentService;
|
|
@@ -63,6 +63,8 @@ export class DraftService {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
catch (error) {
|
|
66
|
+
if (isPassthroughGoogleError(error))
|
|
67
|
+
throw error;
|
|
66
68
|
const details = describeApiError(error);
|
|
67
69
|
logger.warn(`Failed to create draft: ${details}`);
|
|
68
70
|
throw new GmailError('Failed to create draft', 'CREATE_ERROR', details);
|
|
@@ -96,6 +98,8 @@ export class DraftService {
|
|
|
96
98
|
};
|
|
97
99
|
}
|
|
98
100
|
catch (error) {
|
|
101
|
+
if (isPassthroughGoogleError(error))
|
|
102
|
+
throw error;
|
|
99
103
|
throw new GmailError('Failed to list drafts', 'LIST_ERROR', describeApiError(error));
|
|
100
104
|
}
|
|
101
105
|
}
|
|
@@ -121,6 +125,8 @@ export class DraftService {
|
|
|
121
125
|
};
|
|
122
126
|
}
|
|
123
127
|
catch (error) {
|
|
128
|
+
if (isPassthroughGoogleError(error))
|
|
129
|
+
throw error;
|
|
124
130
|
throw new GmailError('Failed to get draft', 'GET_ERROR', describeApiError(error));
|
|
125
131
|
}
|
|
126
132
|
}
|
|
@@ -191,6 +197,8 @@ export class DraftService {
|
|
|
191
197
|
};
|
|
192
198
|
}
|
|
193
199
|
catch (error) {
|
|
200
|
+
if (isPassthroughGoogleError(error))
|
|
201
|
+
throw error;
|
|
194
202
|
const details = describeApiError(error);
|
|
195
203
|
logger.warn(`Failed to update draft ${draftId}: ${details}`);
|
|
196
204
|
throw new GmailError('Failed to update draft', 'UPDATE_ERROR', details);
|
|
@@ -206,6 +214,8 @@ export class DraftService {
|
|
|
206
214
|
return;
|
|
207
215
|
}
|
|
208
216
|
catch (error) {
|
|
217
|
+
if (isPassthroughGoogleError(error))
|
|
218
|
+
throw error;
|
|
209
219
|
throw new GmailError('Failed to delete draft', 'DELETE_ERROR', describeApiError(error));
|
|
210
220
|
}
|
|
211
221
|
}
|
|
@@ -260,6 +270,8 @@ export class DraftService {
|
|
|
260
270
|
};
|
|
261
271
|
}
|
|
262
272
|
catch (error) {
|
|
273
|
+
if (isPassthroughGoogleError(error))
|
|
274
|
+
throw error;
|
|
263
275
|
throw new GmailError('Failed to send draft', 'SEND_ERROR', describeApiError(error));
|
|
264
276
|
}
|
|
265
277
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { isGoogleRecoveryExhausted, preserveGoogleRetryDecision } from '../../../utils/google-retry.js';
|
|
1
2
|
import { GmailError } from '../types.js';
|
|
2
3
|
import { buildMimeMessage } from './mime-builder.js';
|
|
3
4
|
import { AttachmentResponseTransformer } from '../../attachments/response-transformer.js';
|
|
4
5
|
import { AttachmentIndexService } from '../../attachments/index-service.js';
|
|
5
6
|
import logger from '../../../utils/logger.js';
|
|
6
|
-
import { describeApiError } from '../../../utils/apiError.js';
|
|
7
|
+
import { describeApiError, isPassthroughGoogleError } from '../../../utils/apiError.js';
|
|
7
8
|
/**
|
|
8
9
|
* Google/Gaxios not-found shapes differ by call site and transport.
|
|
9
10
|
*/
|
|
@@ -160,6 +161,8 @@ export class EmailService {
|
|
|
160
161
|
};
|
|
161
162
|
}
|
|
162
163
|
catch (error) {
|
|
164
|
+
if (isPassthroughGoogleError(error) && !isGoogleRecoveryExhausted(error))
|
|
165
|
+
throw error;
|
|
163
166
|
if (isNotFoundError(error)) {
|
|
164
167
|
logger.warn({ err: error, messageId }, 'getMessage failed; treating as not found');
|
|
165
168
|
return null;
|
|
@@ -252,7 +255,9 @@ export class EmailService {
|
|
|
252
255
|
};
|
|
253
256
|
}
|
|
254
257
|
catch (error) {
|
|
255
|
-
|
|
258
|
+
if (isPassthroughGoogleError(error) && !isGoogleRecoveryExhausted(error))
|
|
259
|
+
throw error;
|
|
260
|
+
throw preserveGoogleRetryDecision(new GmailError(`Failed to get thread ${threadId}`, 'THREAD_ERROR', `Error: ${describeApiError(error)}`), error);
|
|
256
261
|
}
|
|
257
262
|
}
|
|
258
263
|
/**
|
|
@@ -386,10 +391,12 @@ export class EmailService {
|
|
|
386
391
|
return transformedResponse;
|
|
387
392
|
}
|
|
388
393
|
catch (error) {
|
|
394
|
+
if (isPassthroughGoogleError(error) && !isGoogleRecoveryExhausted(error))
|
|
395
|
+
throw error;
|
|
389
396
|
if (error instanceof GmailError) {
|
|
390
397
|
throw error;
|
|
391
398
|
}
|
|
392
|
-
throw new GmailError('Failed to get emails', 'FETCH_ERROR', `Error: ${describeApiError(error)}`);
|
|
399
|
+
throw preserveGoogleRetryDecision(new GmailError('Failed to get emails', 'FETCH_ERROR', `Error: ${describeApiError(error)}`), error);
|
|
393
400
|
}
|
|
394
401
|
}
|
|
395
402
|
/**
|
|
@@ -453,10 +460,12 @@ export class EmailService {
|
|
|
453
460
|
return response;
|
|
454
461
|
}
|
|
455
462
|
catch (error) {
|
|
463
|
+
if (isPassthroughGoogleError(error) && !isGoogleRecoveryExhausted(error))
|
|
464
|
+
throw error;
|
|
456
465
|
if (error instanceof GmailError) {
|
|
457
466
|
throw error;
|
|
458
467
|
}
|
|
459
|
-
throw new GmailError('Failed to send email', 'SEND_ERROR', `Error: ${describeApiError(error)}`);
|
|
468
|
+
throw preserveGoogleRetryDecision(new GmailError('Failed to send email', 'SEND_ERROR', `Error: ${describeApiError(error)}`), error);
|
|
460
469
|
}
|
|
461
470
|
}
|
|
462
471
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describeApiError } from '../../../utils/apiError.js';
|
|
1
|
+
import { describeApiError, isPassthroughGoogleError } from '../../../utils/apiError.js';
|
|
2
2
|
import { GmailError } from '../types.js';
|
|
3
3
|
import { isValidGmailLabelColor, getNearestGmailLabelColor, LABEL_ERROR_MESSAGES } from '../constants.js';
|
|
4
4
|
export class LabelService {
|
|
@@ -220,6 +220,8 @@ export class LabelService {
|
|
|
220
220
|
return this.mapGmailLabel(response.data);
|
|
221
221
|
}
|
|
222
222
|
catch (error) {
|
|
223
|
+
if (isPassthroughGoogleError(error))
|
|
224
|
+
throw error;
|
|
223
225
|
if (error instanceof Error && 'code' in error && error.code === '401') {
|
|
224
226
|
throw new GmailError('Authentication failed', 'AUTH_ERROR', 'Please re-authenticate your account');
|
|
225
227
|
}
|
|
@@ -242,6 +244,8 @@ export class LabelService {
|
|
|
242
244
|
};
|
|
243
245
|
}
|
|
244
246
|
catch (error) {
|
|
247
|
+
if (isPassthroughGoogleError(error))
|
|
248
|
+
throw error;
|
|
245
249
|
throw new GmailError('Failed to fetch labels', 'FETCH_ERROR', describeApiError(error));
|
|
246
250
|
}
|
|
247
251
|
}
|
|
@@ -276,6 +280,8 @@ export class LabelService {
|
|
|
276
280
|
return this.mapGmailLabel(response.data);
|
|
277
281
|
}
|
|
278
282
|
catch (error) {
|
|
283
|
+
if (isPassthroughGoogleError(error))
|
|
284
|
+
throw error;
|
|
279
285
|
if (error instanceof Error && 'code' in error && error.code === '401') {
|
|
280
286
|
throw new GmailError('Authentication failed', 'AUTH_ERROR', 'Please re-authenticate your account');
|
|
281
287
|
}
|
|
@@ -293,6 +299,8 @@ export class LabelService {
|
|
|
293
299
|
});
|
|
294
300
|
}
|
|
295
301
|
catch (error) {
|
|
302
|
+
if (isPassthroughGoogleError(error))
|
|
303
|
+
throw error;
|
|
296
304
|
throw new GmailError('Failed to delete label', 'DELETE_ERROR', describeApiError(error));
|
|
297
305
|
}
|
|
298
306
|
}
|
|
@@ -308,6 +316,8 @@ export class LabelService {
|
|
|
308
316
|
});
|
|
309
317
|
}
|
|
310
318
|
catch (error) {
|
|
319
|
+
if (isPassthroughGoogleError(error))
|
|
320
|
+
throw error;
|
|
311
321
|
throw new GmailError('Failed to modify message labels', 'MODIFY_ERROR', describeApiError(error));
|
|
312
322
|
}
|
|
313
323
|
}
|
|
@@ -362,6 +372,8 @@ export class LabelService {
|
|
|
362
372
|
};
|
|
363
373
|
}
|
|
364
374
|
catch (error) {
|
|
375
|
+
if (isPassthroughGoogleError(error))
|
|
376
|
+
throw error;
|
|
365
377
|
throw new GmailError('Failed to create label filter', 'CREATE_ERROR', describeApiError(error));
|
|
366
378
|
}
|
|
367
379
|
}
|
|
@@ -409,6 +421,8 @@ export class LabelService {
|
|
|
409
421
|
return { filters };
|
|
410
422
|
}
|
|
411
423
|
catch (error) {
|
|
424
|
+
if (isPassthroughGoogleError(error))
|
|
425
|
+
throw error;
|
|
412
426
|
throw new GmailError('Failed to get label filters', 'FETCH_ERROR', describeApiError(error));
|
|
413
427
|
}
|
|
414
428
|
}
|
|
@@ -468,6 +482,8 @@ export class LabelService {
|
|
|
468
482
|
};
|
|
469
483
|
}
|
|
470
484
|
catch (error) {
|
|
485
|
+
if (isPassthroughGoogleError(error))
|
|
486
|
+
throw error;
|
|
471
487
|
throw new GmailError('Failed to update label filter', 'UPDATE_ERROR', describeApiError(error));
|
|
472
488
|
}
|
|
473
489
|
}
|
|
@@ -479,6 +495,8 @@ export class LabelService {
|
|
|
479
495
|
});
|
|
480
496
|
}
|
|
481
497
|
catch (error) {
|
|
498
|
+
if (isPassthroughGoogleError(error))
|
|
499
|
+
throw error;
|
|
482
500
|
throw new GmailError('Failed to delete label filter', 'DELETE_ERROR', describeApiError(error));
|
|
483
501
|
}
|
|
484
502
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describeApiError } from '../../../utils/apiError.js';
|
|
1
|
+
import { describeApiError, isPassthroughGoogleError } from '../../../utils/apiError.js';
|
|
2
2
|
import { GmailError } from '../types.js';
|
|
3
3
|
export class SettingsService {
|
|
4
4
|
gmailClient;
|
|
@@ -95,6 +95,8 @@ export class SettingsService {
|
|
|
95
95
|
return response;
|
|
96
96
|
}
|
|
97
97
|
catch (error) {
|
|
98
|
+
if (isPassthroughGoogleError(error))
|
|
99
|
+
throw error;
|
|
98
100
|
if (error instanceof GmailError) {
|
|
99
101
|
throw error;
|
|
100
102
|
}
|
|
@@ -164,6 +166,8 @@ export class SettingsService {
|
|
|
164
166
|
};
|
|
165
167
|
}
|
|
166
168
|
catch (error) {
|
|
169
|
+
if (isPassthroughGoogleError(error))
|
|
170
|
+
throw error;
|
|
167
171
|
if (error instanceof GmailError) {
|
|
168
172
|
throw error;
|
|
169
173
|
}
|
|
@@ -189,6 +193,8 @@ export class SettingsService {
|
|
|
189
193
|
return { sendAs };
|
|
190
194
|
}
|
|
191
195
|
catch (error) {
|
|
196
|
+
if (isPassthroughGoogleError(error))
|
|
197
|
+
throw error;
|
|
192
198
|
if (error instanceof GmailError) {
|
|
193
199
|
throw error;
|
|
194
200
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { google } from 'googleapis';
|
|
2
2
|
import { BaseGoogleService } from '../../services/base/BaseGoogleService.js';
|
|
3
|
-
import { describeApiErrorUntrusted,
|
|
3
|
+
import { describeApiErrorUntrusted, isPassthroughGoogleError } from '../../utils/apiError.js';
|
|
4
4
|
import { computeMoveApiIndex } from '../../utils/tabPosition.js';
|
|
5
5
|
import { SheetsInputError, } from './types.js';
|
|
6
6
|
import { SHEETS_SCOPES } from './scopes.js';
|
|
@@ -524,7 +524,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
524
524
|
}
|
|
525
525
|
catch (error) {
|
|
526
526
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
527
|
-
if (
|
|
527
|
+
if (isPassthroughGoogleError(error))
|
|
528
528
|
throw error;
|
|
529
529
|
return {
|
|
530
530
|
success: false,
|
|
@@ -585,7 +585,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
585
585
|
}
|
|
586
586
|
catch (error) {
|
|
587
587
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
588
|
-
if (
|
|
588
|
+
if (isPassthroughGoogleError(error))
|
|
589
589
|
throw error;
|
|
590
590
|
if (error instanceof ContinuationTokenError) {
|
|
591
591
|
return {
|
|
@@ -654,7 +654,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
654
654
|
}
|
|
655
655
|
catch (error) {
|
|
656
656
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
657
|
-
if (
|
|
657
|
+
if (isPassthroughGoogleError(error))
|
|
658
658
|
throw error;
|
|
659
659
|
if (error instanceof ContinuationTokenError) {
|
|
660
660
|
return {
|
|
@@ -762,7 +762,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
762
762
|
}
|
|
763
763
|
catch (error) {
|
|
764
764
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
765
|
-
if (
|
|
765
|
+
if (isPassthroughGoogleError(error))
|
|
766
766
|
throw error;
|
|
767
767
|
const kind = this.classifyFormulaPreReadError(error);
|
|
768
768
|
const rewrittenError = rewriteSheetsApiError(error, {
|
|
@@ -963,7 +963,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
963
963
|
}
|
|
964
964
|
catch (error) {
|
|
965
965
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
966
|
-
if (
|
|
966
|
+
if (isPassthroughGoogleError(error))
|
|
967
967
|
throw error;
|
|
968
968
|
return {
|
|
969
969
|
success: false,
|
|
@@ -1022,7 +1022,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
1022
1022
|
}
|
|
1023
1023
|
catch (error) {
|
|
1024
1024
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
1025
|
-
if (
|
|
1025
|
+
if (isPassthroughGoogleError(error))
|
|
1026
1026
|
throw error;
|
|
1027
1027
|
return {
|
|
1028
1028
|
success: false,
|
|
@@ -1086,7 +1086,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
1086
1086
|
}
|
|
1087
1087
|
catch (error) {
|
|
1088
1088
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
1089
|
-
if (
|
|
1089
|
+
if (isPassthroughGoogleError(error))
|
|
1090
1090
|
throw error;
|
|
1091
1091
|
return {
|
|
1092
1092
|
success: false,
|
|
@@ -1119,7 +1119,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
1119
1119
|
}
|
|
1120
1120
|
catch (error) {
|
|
1121
1121
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
1122
|
-
if (
|
|
1122
|
+
if (isPassthroughGoogleError(error))
|
|
1123
1123
|
throw error;
|
|
1124
1124
|
return {
|
|
1125
1125
|
success: false,
|
|
@@ -1175,7 +1175,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
1175
1175
|
}
|
|
1176
1176
|
catch (error) {
|
|
1177
1177
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
1178
|
-
if (
|
|
1178
|
+
if (isPassthroughGoogleError(error))
|
|
1179
1179
|
throw error;
|
|
1180
1180
|
return {
|
|
1181
1181
|
success: false,
|
|
@@ -1215,7 +1215,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
1215
1215
|
}
|
|
1216
1216
|
catch (error) {
|
|
1217
1217
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
1218
|
-
if (
|
|
1218
|
+
if (isPassthroughGoogleError(error))
|
|
1219
1219
|
throw error;
|
|
1220
1220
|
return {
|
|
1221
1221
|
success: false,
|
|
@@ -1251,7 +1251,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
1251
1251
|
}
|
|
1252
1252
|
catch (error) {
|
|
1253
1253
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
1254
|
-
if (
|
|
1254
|
+
if (isPassthroughGoogleError(error))
|
|
1255
1255
|
throw error;
|
|
1256
1256
|
return {
|
|
1257
1257
|
success: false,
|
|
@@ -1551,7 +1551,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
1551
1551
|
}
|
|
1552
1552
|
catch (error) {
|
|
1553
1553
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
1554
|
-
if (
|
|
1554
|
+
if (isPassthroughGoogleError(error))
|
|
1555
1555
|
throw error;
|
|
1556
1556
|
if (error instanceof ContinuationTokenError) {
|
|
1557
1557
|
return {
|
|
@@ -1660,7 +1660,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
1660
1660
|
}
|
|
1661
1661
|
catch (error) {
|
|
1662
1662
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
1663
|
-
if (
|
|
1663
|
+
if (isPassthroughGoogleError(error))
|
|
1664
1664
|
throw error;
|
|
1665
1665
|
if (error instanceof ContinuationTokenError) {
|
|
1666
1666
|
return {
|
|
@@ -1744,7 +1744,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
1744
1744
|
}
|
|
1745
1745
|
catch (error) {
|
|
1746
1746
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
1747
|
-
if (
|
|
1747
|
+
if (isPassthroughGoogleError(error))
|
|
1748
1748
|
throw error;
|
|
1749
1749
|
return {
|
|
1750
1750
|
success: false,
|
|
@@ -1795,7 +1795,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
1795
1795
|
}
|
|
1796
1796
|
catch (error) {
|
|
1797
1797
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
1798
|
-
if (
|
|
1798
|
+
if (isPassthroughGoogleError(error))
|
|
1799
1799
|
throw error;
|
|
1800
1800
|
return {
|
|
1801
1801
|
success: false,
|
|
@@ -1918,7 +1918,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
1918
1918
|
}
|
|
1919
1919
|
catch (error) {
|
|
1920
1920
|
// Keep the reconnect signal: an expired/revoked grant must not collapse to a plain string.
|
|
1921
|
-
if (
|
|
1921
|
+
if (isPassthroughGoogleError(error))
|
|
1922
1922
|
throw error;
|
|
1923
1923
|
return {
|
|
1924
1924
|
success: false,
|
|
@@ -1934,7 +1934,7 @@ export class SheetsService extends BaseGoogleService {
|
|
|
1934
1934
|
*/
|
|
1935
1935
|
function toSheetTabFailure(error) {
|
|
1936
1936
|
// An expired/revoked grant must keep its reconnect signal.
|
|
1937
|
-
if (
|
|
1937
|
+
if (isPassthroughGoogleError(error))
|
|
1938
1938
|
throw error;
|
|
1939
1939
|
if (error instanceof SheetsInputError)
|
|
1940
1940
|
throw error;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { google } from 'googleapis';
|
|
2
2
|
import { BaseGoogleService } from '../../services/base/BaseGoogleService.js';
|
|
3
3
|
import { SLIDES_SCOPES } from './scopes.js';
|
|
4
|
-
import { describeApiError,
|
|
4
|
+
import { describeApiError, isPassthroughGoogleError } from '../../utils/apiError.js';
|
|
5
5
|
const DEFAULT_MAX_CHARS = 50000;
|
|
6
6
|
const TRUNCATION_MARKER = '\n\n[TRUNCATED - presentation exceeds character limit]';
|
|
7
7
|
export class SlidesService extends BaseGoogleService {
|
|
@@ -202,7 +202,7 @@ export class SlidesService extends BaseGoogleService {
|
|
|
202
202
|
catch (error) {
|
|
203
203
|
// An expired/revoked grant must keep its reconnect signal — folding it
|
|
204
204
|
// into a plain error string would skip the host's auth_required handoff.
|
|
205
|
-
if (
|
|
205
|
+
if (isPassthroughGoogleError(error))
|
|
206
206
|
throw error;
|
|
207
207
|
return {
|
|
208
208
|
success: false,
|
|
@@ -245,7 +245,7 @@ export class SlidesService extends BaseGoogleService {
|
|
|
245
245
|
catch (error) {
|
|
246
246
|
// An expired/revoked grant must keep its reconnect signal — folding it
|
|
247
247
|
// into a plain error string would skip the host's auth_required handoff.
|
|
248
|
-
if (
|
|
248
|
+
if (isPassthroughGoogleError(error))
|
|
249
249
|
throw error;
|
|
250
250
|
return {
|
|
251
251
|
success: false,
|
|
@@ -275,7 +275,7 @@ export class SlidesService extends BaseGoogleService {
|
|
|
275
275
|
catch (error) {
|
|
276
276
|
// An expired/revoked grant must keep its reconnect signal — folding it
|
|
277
277
|
// into a plain error string would skip the host's auth_required handoff.
|
|
278
|
-
if (
|
|
278
|
+
if (isPassthroughGoogleError(error))
|
|
279
279
|
throw error;
|
|
280
280
|
return {
|
|
281
281
|
success: false,
|
|
@@ -330,7 +330,7 @@ export class SlidesService extends BaseGoogleService {
|
|
|
330
330
|
catch (error) {
|
|
331
331
|
// An expired/revoked grant must keep its reconnect signal — folding it
|
|
332
332
|
// into a plain error string would skip the host's auth_required handoff.
|
|
333
|
-
if (
|
|
333
|
+
if (isPassthroughGoogleError(error))
|
|
334
334
|
throw error;
|
|
335
335
|
return {
|
|
336
336
|
success: false,
|
|
@@ -368,7 +368,7 @@ export class SlidesService extends BaseGoogleService {
|
|
|
368
368
|
catch (error) {
|
|
369
369
|
// An expired/revoked grant must keep its reconnect signal — folding it
|
|
370
370
|
// into a plain error string would skip the host's auth_required handoff.
|
|
371
|
-
if (
|
|
371
|
+
if (isPassthroughGoogleError(error))
|
|
372
372
|
throw error;
|
|
373
373
|
return {
|
|
374
374
|
success: false,
|
|
@@ -407,7 +407,7 @@ export class SlidesService extends BaseGoogleService {
|
|
|
407
407
|
catch (error) {
|
|
408
408
|
// An expired/revoked grant must keep its reconnect signal — folding it
|
|
409
409
|
// into a plain error string would skip the host's auth_required handoff.
|
|
410
|
-
if (
|
|
410
|
+
if (isPassthroughGoogleError(error))
|
|
411
411
|
throw error;
|
|
412
412
|
return {
|
|
413
413
|
success: false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { google } from 'googleapis';
|
|
2
2
|
import { BaseGoogleService } from '../../services/base/BaseGoogleService.js';
|
|
3
|
-
import { describeApiError,
|
|
3
|
+
import { describeApiError, isPassthroughGoogleError } from '../../utils/apiError.js';
|
|
4
4
|
import { TASKS_SCOPES } from './scopes.js';
|
|
5
5
|
/**
|
|
6
6
|
* Service for interacting with Google Tasks API.
|
|
@@ -81,7 +81,7 @@ export class TasksService extends BaseGoogleService {
|
|
|
81
81
|
catch (error) {
|
|
82
82
|
// An expired/revoked grant must keep its reconnect signal — folding it
|
|
83
83
|
// into a plain error string would skip the host's auth_required handoff.
|
|
84
|
-
if (
|
|
84
|
+
if (isPassthroughGoogleError(error))
|
|
85
85
|
throw error;
|
|
86
86
|
return {
|
|
87
87
|
success: false,
|
|
@@ -145,7 +145,7 @@ export class TasksService extends BaseGoogleService {
|
|
|
145
145
|
catch (error) {
|
|
146
146
|
// An expired/revoked grant must keep its reconnect signal — folding it
|
|
147
147
|
// into a plain error string would skip the host's auth_required handoff.
|
|
148
|
-
if (
|
|
148
|
+
if (isPassthroughGoogleError(error))
|
|
149
149
|
throw error;
|
|
150
150
|
return {
|
|
151
151
|
success: false,
|
|
@@ -197,7 +197,7 @@ export class TasksService extends BaseGoogleService {
|
|
|
197
197
|
catch (error) {
|
|
198
198
|
// An expired/revoked grant must keep its reconnect signal — folding it
|
|
199
199
|
// into a plain error string would skip the host's auth_required handoff.
|
|
200
|
-
if (
|
|
200
|
+
if (isPassthroughGoogleError(error))
|
|
201
201
|
throw error;
|
|
202
202
|
return {
|
|
203
203
|
success: false,
|
|
@@ -242,7 +242,7 @@ export class TasksService extends BaseGoogleService {
|
|
|
242
242
|
catch (error) {
|
|
243
243
|
// An expired/revoked grant must keep its reconnect signal — folding it
|
|
244
244
|
// into a plain error string would skip the host's auth_required handoff.
|
|
245
|
-
if (
|
|
245
|
+
if (isPassthroughGoogleError(error))
|
|
246
246
|
throw error;
|
|
247
247
|
return {
|
|
248
248
|
success: false,
|
|
@@ -301,7 +301,7 @@ export class TasksService extends BaseGoogleService {
|
|
|
301
301
|
catch (error) {
|
|
302
302
|
// An expired/revoked grant must keep its reconnect signal — folding it
|
|
303
303
|
// into a plain error string would skip the host's auth_required handoff.
|
|
304
|
-
if (
|
|
304
|
+
if (isPassthroughGoogleError(error))
|
|
305
305
|
throw error;
|
|
306
306
|
return {
|
|
307
307
|
success: false,
|
|
@@ -332,7 +332,7 @@ export class TasksService extends BaseGoogleService {
|
|
|
332
332
|
catch (error) {
|
|
333
333
|
// An expired/revoked grant must keep its reconnect signal — folding it
|
|
334
334
|
// into a plain error string would skip the host's auth_required handoff.
|
|
335
|
-
if (
|
|
335
|
+
if (isPassthroughGoogleError(error))
|
|
336
336
|
throw error;
|
|
337
337
|
return {
|
|
338
338
|
success: false,
|
|
@@ -2,7 +2,7 @@ import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
|
2
2
|
import { getAccountManager } from '../../modules/accounts/index.js';
|
|
3
3
|
import { AccountError } from '../../modules/accounts/types.js';
|
|
4
4
|
import { findMissingScopes, getServiceNamesForScopes } from '../../utils/scope-hierarchy.js';
|
|
5
|
-
import {
|
|
5
|
+
import { isPassthroughGoogleError } from '../../utils/apiError.js';
|
|
6
6
|
/**
|
|
7
7
|
* Base error class for Google services
|
|
8
8
|
*/
|
|
@@ -90,7 +90,7 @@ export class BaseGoogleService {
|
|
|
90
90
|
* used to hit on a first-request auth failure.
|
|
91
91
|
*/
|
|
92
92
|
handleError(error, context) {
|
|
93
|
-
if (
|
|
93
|
+
if (isPassthroughGoogleError(error) && error instanceof Error) {
|
|
94
94
|
return error;
|
|
95
95
|
}
|
|
96
96
|
if (error instanceof GoogleServiceError) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isPassthroughGoogleError } from '../../utils/apiError.js';
|
|
1
2
|
import { google } from "googleapis";
|
|
2
3
|
import { BaseGoogleService, GoogleServiceError } from "../base/BaseGoogleService.js";
|
|
3
4
|
import { ChatError } from "../../modules/chat/types.js";
|
|
@@ -97,6 +98,8 @@ export class ChatService extends BaseGoogleService {
|
|
|
97
98
|
* GoogleServiceError keeps its code/details, anything else becomes an unknown error.
|
|
98
99
|
*/
|
|
99
100
|
toChatError(error, fallbackMessage) {
|
|
101
|
+
if (isPassthroughGoogleError(error))
|
|
102
|
+
throw error;
|
|
100
103
|
// Handle known GoogleServiceError specifically
|
|
101
104
|
if (error instanceof GoogleServiceError) {
|
|
102
105
|
// Assuming GoogleServiceError inherits message and data from McpError
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { google } from "googleapis";
|
|
2
2
|
import { BaseGoogleService, GoogleServiceError } from "../base/BaseGoogleService.js";
|
|
3
|
-
import { describeApiError,
|
|
3
|
+
import { describeApiError, isPassthroughGoogleError } from "../../utils/apiError.js";
|
|
4
|
+
import { isGoogleRecoveryExhausted } from "../../utils/google-retry.js";
|
|
4
5
|
import { ContactsError } from "../../modules/contacts/types.js";
|
|
5
6
|
import { CONTACTS_SCOPES } from "../../modules/contacts/scopes.js";
|
|
6
7
|
/**
|
|
@@ -49,7 +50,7 @@ export class ContactsService extends BaseGoogleService {
|
|
|
49
50
|
return response.data;
|
|
50
51
|
}
|
|
51
52
|
catch (error) {
|
|
52
|
-
if (
|
|
53
|
+
if (isPassthroughGoogleError(error))
|
|
53
54
|
throw error;
|
|
54
55
|
// Handle known GoogleServiceError specifically
|
|
55
56
|
if (error instanceof GoogleServiceError) {
|
|
@@ -91,7 +92,9 @@ export class ContactsService extends BaseGoogleService {
|
|
|
91
92
|
pageSize: 1,
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
|
-
catch {
|
|
95
|
+
catch (error) {
|
|
96
|
+
if (isGoogleRecoveryExhausted(error))
|
|
97
|
+
throw error;
|
|
95
98
|
// Warmup failures are non-fatal - continue with actual search
|
|
96
99
|
}
|
|
97
100
|
// Actual search
|
|
@@ -116,7 +119,7 @@ export class ContactsService extends BaseGoogleService {
|
|
|
116
119
|
};
|
|
117
120
|
}
|
|
118
121
|
catch (error) {
|
|
119
|
-
if (
|
|
122
|
+
if (isPassthroughGoogleError(error))
|
|
120
123
|
throw error;
|
|
121
124
|
if (error instanceof GoogleServiceError) {
|
|
122
125
|
const gError = error;
|
|
@@ -183,7 +186,7 @@ export class ContactsService extends BaseGoogleService {
|
|
|
183
186
|
};
|
|
184
187
|
}
|
|
185
188
|
wrapWriteError(error, action) {
|
|
186
|
-
if (
|
|
189
|
+
if (isPassthroughGoogleError(error) && error instanceof Error)
|
|
187
190
|
return error;
|
|
188
191
|
if (error instanceof GoogleServiceError) {
|
|
189
192
|
const gError = error;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isPassthroughGoogleError } from '../../utils/apiError.js';
|
|
1
2
|
import { google } from "googleapis";
|
|
2
3
|
import { BaseGoogleService, GoogleServiceError } from "../base/BaseGoogleService.js";
|
|
3
4
|
import { MeetError } from "../../modules/meet/types.js";
|
|
@@ -27,6 +28,8 @@ export class MeetService extends BaseGoogleService {
|
|
|
27
28
|
* Maps a thrown error into a MeetError, mirroring the Contacts service.
|
|
28
29
|
*/
|
|
29
30
|
toMeetError(error, action) {
|
|
31
|
+
if (isPassthroughGoogleError(error))
|
|
32
|
+
throw error;
|
|
30
33
|
if (error instanceof GoogleServiceError) {
|
|
31
34
|
// Assuming GoogleServiceError inherits message and data from McpError
|
|
32
35
|
// Use type assertion as the linter seems unsure
|