@mindstone/mcp-server-google-workspace 0.4.1 → 0.5.0
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 +43 -5
- package/dist/modules/docs/service.d.ts +76 -6
- package/dist/modules/docs/service.js +791 -103
- package/dist/modules/docs/tabCopy.d.ts +266 -0
- package/dist/modules/docs/tabCopy.js +794 -0
- package/dist/modules/docs/tabs.d.ts +161 -0
- package/dist/modules/docs/tabs.js +416 -0
- package/dist/modules/docs/types.d.ts +141 -1
- package/dist/modules/drive/service.d.ts +15 -0
- package/dist/modules/drive/service.js +77 -2
- package/dist/modules/drive/types.d.ts +1 -1
- package/dist/modules/sheets/a1Utils.d.ts +13 -0
- package/dist/modules/sheets/a1Utils.js +33 -7
- package/dist/modules/sheets/formatters.d.ts +33 -2
- package/dist/modules/sheets/formatters.js +84 -5
- package/dist/modules/sheets/service.d.ts +26 -1
- package/dist/modules/sheets/service.js +264 -8
- package/dist/modules/sheets/types.d.ts +71 -0
- package/dist/modules/sheets/types.js +12 -1
- package/dist/modules/sheets/writeGuards.js +2 -2
- package/dist/tools/definitions/destructive-overrides.json +8 -0
- package/dist/tools/definitions/docs.js +395 -9
- package/dist/tools/definitions/drive.js +9 -4
- package/dist/tools/definitions/gmail.js +30 -3
- package/dist/tools/definitions/open-world-overrides.json +8 -0
- package/dist/tools/definitions/sheets.js +177 -1
- package/dist/tools/docs-handlers.d.ts +125 -0
- package/dist/tools/docs-handlers.js +397 -15
- package/dist/tools/gmail-handlers.d.ts +3 -0
- package/dist/tools/gmail-handlers.js +19 -5
- package/dist/tools/param-normalizer.js +16 -0
- package/dist/tools/server.js +35 -3
- package/dist/tools/sheets-handlers.d.ts +54 -1
- package/dist/tools/sheets-handlers.js +107 -13
- package/dist/tools/type-guards.d.ts +89 -0
- package/dist/tools/type-guards.js +190 -6
- package/dist/tools/types.d.ts +1 -1
- package/dist/utils/apiError.d.ts +6 -0
- package/dist/utils/apiError.js +12 -0
- package/dist/utils/tabPosition.d.ts +20 -0
- package/dist/utils/tabPosition.js +19 -0
- package/package.json +1 -1
|
@@ -125,7 +125,7 @@ export function isDriveFileListArgs(args) {
|
|
|
125
125
|
return (opts.folderId === undefined || typeof opts.folderId === 'string') &&
|
|
126
126
|
(opts.query === undefined || typeof opts.query === 'string') &&
|
|
127
127
|
(opts.pageSize === undefined || typeof opts.pageSize === 'number') &&
|
|
128
|
-
(opts.orderBy === undefined || (Array.isArray(opts.orderBy) && opts.orderBy.every((o) => typeof o === 'string'))) &&
|
|
128
|
+
(opts.orderBy === undefined || typeof opts.orderBy === 'string' || (Array.isArray(opts.orderBy) && opts.orderBy.every((o) => typeof o === 'string'))) &&
|
|
129
129
|
(opts.fields === undefined || (Array.isArray(opts.fields) && opts.fields.every((f) => typeof f === 'string'))) &&
|
|
130
130
|
(opts.driveId === undefined || typeof opts.driveId === 'string') &&
|
|
131
131
|
isValidCorpora(opts.corpora);
|
|
@@ -479,10 +479,14 @@ export function isReadDocumentArgs(args) {
|
|
|
479
479
|
const documentId = readAliasedArg(rawParams, 'document_id', 'documentId');
|
|
480
480
|
const maxChars = readAliasedArg(rawParams, 'max_chars', 'maxChars');
|
|
481
481
|
const returnJson = readAliasedArg(rawParams, 'return_json', 'returnJson');
|
|
482
|
+
const tabId = readAliasedArg(rawParams, 'tab_id', 'tabId');
|
|
483
|
+
const allTabs = readAliasedArg(rawParams, 'all_tabs', 'allTabs');
|
|
482
484
|
return (params.email === undefined || typeof params.email === 'string') &&
|
|
483
485
|
typeof documentId === 'string' &&
|
|
484
486
|
(maxChars === undefined || typeof maxChars === 'number') &&
|
|
485
|
-
(returnJson === undefined || typeof returnJson === 'boolean')
|
|
487
|
+
(returnJson === undefined || typeof returnJson === 'boolean') &&
|
|
488
|
+
(tabId === undefined || typeof tabId === 'string') &&
|
|
489
|
+
(allTabs === undefined || typeof allTabs === 'boolean');
|
|
486
490
|
}
|
|
487
491
|
export function assertReadDocumentArgs(args) {
|
|
488
492
|
if (!isReadDocumentArgs(args)) {
|
|
@@ -507,9 +511,11 @@ export function isAppendDocumentArgs(args) {
|
|
|
507
511
|
return false;
|
|
508
512
|
const params = args;
|
|
509
513
|
const documentId = readAliasedArg(args, 'document_id', 'documentId');
|
|
514
|
+
const tabId = readAliasedArg(args, 'tab_id', 'tabId');
|
|
510
515
|
return (params.email === undefined || typeof params.email === 'string') &&
|
|
511
516
|
typeof documentId === 'string' &&
|
|
512
|
-
typeof params.text === 'string'
|
|
517
|
+
typeof params.text === 'string' &&
|
|
518
|
+
(tabId === undefined || typeof tabId === 'string');
|
|
513
519
|
}
|
|
514
520
|
export function assertAppendDocumentArgs(args) {
|
|
515
521
|
if (!isAppendDocumentArgs(args)) {
|
|
@@ -521,9 +527,11 @@ export function isReplaceDocumentArgs(args) {
|
|
|
521
527
|
return false;
|
|
522
528
|
const params = args;
|
|
523
529
|
const documentId = readAliasedArg(args, 'document_id', 'documentId');
|
|
530
|
+
const tabId = readAliasedArg(args, 'tab_id', 'tabId');
|
|
524
531
|
return (params.email === undefined || typeof params.email === 'string') &&
|
|
525
532
|
typeof documentId === 'string' &&
|
|
526
|
-
typeof params.content === 'string'
|
|
533
|
+
typeof params.content === 'string' &&
|
|
534
|
+
(tabId === undefined || typeof tabId === 'string');
|
|
527
535
|
}
|
|
528
536
|
export function assertReplaceDocumentArgs(args) {
|
|
529
537
|
if (!isReplaceDocumentArgs(args)) {
|
|
@@ -539,11 +547,13 @@ export function isFindReplaceArgs(args) {
|
|
|
539
547
|
const findText = readAliasedArg(rawParams, 'find_text', 'findText');
|
|
540
548
|
const replaceText = readAliasedArg(rawParams, 'replace_text', 'replaceText');
|
|
541
549
|
const matchCase = readAliasedArg(rawParams, 'match_case', 'matchCase');
|
|
550
|
+
const tabId = readAliasedArg(rawParams, 'tab_id', 'tabId');
|
|
542
551
|
return (params.email === undefined || typeof params.email === 'string') &&
|
|
543
552
|
typeof documentId === 'string' &&
|
|
544
553
|
typeof findText === 'string' &&
|
|
545
554
|
typeof replaceText === 'string' &&
|
|
546
|
-
(matchCase === undefined || typeof matchCase === 'boolean')
|
|
555
|
+
(matchCase === undefined || typeof matchCase === 'boolean') &&
|
|
556
|
+
(tabId === undefined || typeof tabId === 'string');
|
|
547
557
|
}
|
|
548
558
|
export function assertFindReplaceArgs(args) {
|
|
549
559
|
if (!isFindReplaceArgs(args)) {
|
|
@@ -568,15 +578,123 @@ export function isListTabsArgs(args) {
|
|
|
568
578
|
const rawParams = args;
|
|
569
579
|
const documentId = readAliasedArg(rawParams, 'document_id', 'documentId');
|
|
570
580
|
const includeWordCount = readAliasedArg(rawParams, 'include_word_count', 'includeWordCount');
|
|
581
|
+
const returnJson = readAliasedArg(rawParams, 'return_json', 'returnJson');
|
|
571
582
|
return (params.email === undefined || typeof params.email === 'string') &&
|
|
572
583
|
typeof documentId === 'string' &&
|
|
573
|
-
(includeWordCount === undefined || typeof includeWordCount === 'boolean')
|
|
584
|
+
(includeWordCount === undefined || typeof includeWordCount === 'boolean') &&
|
|
585
|
+
(returnJson === undefined || typeof returnJson === 'boolean');
|
|
574
586
|
}
|
|
575
587
|
export function assertListTabsArgs(args) {
|
|
576
588
|
if (!isListTabsArgs(args)) {
|
|
577
589
|
throw new Error('Invalid list tabs parameters. Required: email, document_id');
|
|
578
590
|
}
|
|
579
591
|
}
|
|
592
|
+
function isOptional(value, type) {
|
|
593
|
+
return value === undefined || typeof value === type;
|
|
594
|
+
}
|
|
595
|
+
export function isAddDocumentTabArgs(args) {
|
|
596
|
+
if (typeof args !== 'object' || args === null)
|
|
597
|
+
return false;
|
|
598
|
+
const rawParams = args;
|
|
599
|
+
const documentId = readAliasedArg(rawParams, 'document_id', 'documentId');
|
|
600
|
+
const parentTabId = readAliasedArg(rawParams, 'parent_tab_id', 'parentTabId');
|
|
601
|
+
return isOptional(rawParams.email, 'string') &&
|
|
602
|
+
typeof documentId === 'string' &&
|
|
603
|
+
typeof rawParams.title === 'string' &&
|
|
604
|
+
isOptional(parentTabId, 'string') &&
|
|
605
|
+
isOptional(rawParams.position, 'number');
|
|
606
|
+
}
|
|
607
|
+
export function assertAddDocumentTabArgs(args) {
|
|
608
|
+
if (!isAddDocumentTabArgs(args)) {
|
|
609
|
+
throw new Error('Invalid add document tab parameters. Required: document_id, title. Optional: parent_tab_id (string), position (number)');
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
export function isUpdateDocumentTabArgs(args) {
|
|
613
|
+
if (typeof args !== 'object' || args === null)
|
|
614
|
+
return false;
|
|
615
|
+
const rawParams = args;
|
|
616
|
+
const documentId = readAliasedArg(rawParams, 'document_id', 'documentId');
|
|
617
|
+
const tabId = readAliasedArg(rawParams, 'tab_id', 'tabId');
|
|
618
|
+
const parentTabId = readAliasedArg(rawParams, 'parent_tab_id', 'parentTabId');
|
|
619
|
+
return isOptional(rawParams.email, 'string') &&
|
|
620
|
+
typeof documentId === 'string' &&
|
|
621
|
+
typeof tabId === 'string' &&
|
|
622
|
+
isOptional(rawParams.title, 'string') &&
|
|
623
|
+
isOptional(parentTabId, 'string') &&
|
|
624
|
+
isOptional(rawParams.position, 'number');
|
|
625
|
+
}
|
|
626
|
+
export function assertUpdateDocumentTabArgs(args) {
|
|
627
|
+
if (!isUpdateDocumentTabArgs(args)) {
|
|
628
|
+
throw new Error('Invalid update document tab parameters. Required: document_id, tab_id. Optional: title (string), parent_tab_id (string), position (number)');
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
export function isDeleteDocumentTabArgs(args) {
|
|
632
|
+
if (typeof args !== 'object' || args === null)
|
|
633
|
+
return false;
|
|
634
|
+
const rawParams = args;
|
|
635
|
+
const documentId = readAliasedArg(rawParams, 'document_id', 'documentId');
|
|
636
|
+
const tabId = readAliasedArg(rawParams, 'tab_id', 'tabId');
|
|
637
|
+
const deleteSubTabs = readAliasedArg(rawParams, 'delete_sub_tabs', 'deleteSubTabs');
|
|
638
|
+
return isOptional(rawParams.email, 'string') &&
|
|
639
|
+
typeof documentId === 'string' &&
|
|
640
|
+
typeof tabId === 'string' &&
|
|
641
|
+
isOptional(deleteSubTabs, 'boolean');
|
|
642
|
+
}
|
|
643
|
+
export function assertDeleteDocumentTabArgs(args) {
|
|
644
|
+
if (!isDeleteDocumentTabArgs(args)) {
|
|
645
|
+
throw new Error('Invalid delete document tab parameters. Required: document_id, tab_id. Optional: delete_sub_tabs (boolean)');
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
export function isInsertDocumentTextArgs(args) {
|
|
649
|
+
if (typeof args !== 'object' || args === null)
|
|
650
|
+
return false;
|
|
651
|
+
const rawParams = args;
|
|
652
|
+
const documentId = readAliasedArg(rawParams, 'document_id', 'documentId');
|
|
653
|
+
const tabId = readAliasedArg(rawParams, 'tab_id', 'tabId');
|
|
654
|
+
const anchorText = readAliasedArg(rawParams, 'anchor_text', 'anchorText');
|
|
655
|
+
const matchCase = readAliasedArg(rawParams, 'match_case', 'matchCase');
|
|
656
|
+
const expectEmptyParagraph = readAliasedArg(rawParams, 'expect_empty_paragraph', 'expectEmptyParagraph');
|
|
657
|
+
return isOptional(rawParams.email, 'string') &&
|
|
658
|
+
typeof documentId === 'string' &&
|
|
659
|
+
isOptional(tabId, 'string') &&
|
|
660
|
+
typeof anchorText === 'string' &&
|
|
661
|
+
// Allowed values are checked by the service, which names them in its error.
|
|
662
|
+
isOptional(rawParams.position, 'string') &&
|
|
663
|
+
typeof rawParams.text === 'string' &&
|
|
664
|
+
isOptional(matchCase, 'boolean') &&
|
|
665
|
+
isOptional(expectEmptyParagraph, 'boolean');
|
|
666
|
+
}
|
|
667
|
+
export function assertInsertDocumentTextArgs(args) {
|
|
668
|
+
if (!isInsertDocumentTextArgs(args)) {
|
|
669
|
+
throw new Error('Invalid insert document text parameters. Required: document_id, anchor_text, text. Optional: tab_id (string), position ("after" | "before" | "next_paragraph_start"), match_case (boolean), expect_empty_paragraph (boolean)');
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
export function isCopyDocumentTabArgs(args) {
|
|
673
|
+
if (typeof args !== 'object' || args === null)
|
|
674
|
+
return false;
|
|
675
|
+
const rawParams = args;
|
|
676
|
+
const documentId = readAliasedArg(rawParams, 'document_id', 'documentId');
|
|
677
|
+
const sourceTabId = readAliasedArg(rawParams, 'source_tab_id', 'sourceTabId');
|
|
678
|
+
const targetTabId = readAliasedArg(rawParams, 'target_tab_id', 'targetTabId');
|
|
679
|
+
const overwriteExisting = readAliasedArg(rawParams, 'overwrite_existing', 'overwriteExisting');
|
|
680
|
+
const newTabTitle = readAliasedArg(rawParams, 'new_tab_title', 'newTabTitle');
|
|
681
|
+
const newTabParentId = readAliasedArg(rawParams, 'new_tab_parent_id', 'newTabParentId');
|
|
682
|
+
const newTabPosition = readAliasedArg(rawParams, 'new_tab_position', 'newTabPosition');
|
|
683
|
+
// Which target arguments may be combined is checked by the service, which explains it.
|
|
684
|
+
return isOptional(rawParams.email, 'string') &&
|
|
685
|
+
typeof documentId === 'string' &&
|
|
686
|
+
typeof sourceTabId === 'string' &&
|
|
687
|
+
isOptional(targetTabId, 'string') &&
|
|
688
|
+
isOptional(overwriteExisting, 'boolean') &&
|
|
689
|
+
isOptional(newTabTitle, 'string') &&
|
|
690
|
+
isOptional(newTabParentId, 'string') &&
|
|
691
|
+
isOptional(newTabPosition, 'number');
|
|
692
|
+
}
|
|
693
|
+
export function assertCopyDocumentTabArgs(args) {
|
|
694
|
+
if (!isCopyDocumentTabArgs(args)) {
|
|
695
|
+
throw new Error('Invalid copy document tab parameters. Required: document_id, source_tab_id, and either target_tab_id (with overwrite_existing: true) or new_tab_title. Optional with new_tab_title: new_tab_parent_id (string), new_tab_position (number)');
|
|
696
|
+
}
|
|
697
|
+
}
|
|
580
698
|
export function isBatchUpdateDocumentArgs(args) {
|
|
581
699
|
if (typeof args !== 'object' || args === null)
|
|
582
700
|
return false;
|
|
@@ -862,6 +980,72 @@ export function assertDeleteSpreadsheetSheetArgs(args) {
|
|
|
862
980
|
throw new Error('Invalid delete spreadsheet sheet parameters. Required: email, spreadsheet_id, sheet_id');
|
|
863
981
|
}
|
|
864
982
|
}
|
|
983
|
+
export function isDuplicateSpreadsheetSheetArgs(args) {
|
|
984
|
+
if (typeof args !== 'object' || args === null)
|
|
985
|
+
return false;
|
|
986
|
+
const rawParams = args;
|
|
987
|
+
const spreadsheetId = readAliasedArg(rawParams, 'spreadsheet_id', 'spreadsheetId');
|
|
988
|
+
const sheetId = readAliasedArg(rawParams, 'sheet_id', 'sheetId');
|
|
989
|
+
const sheetTitle = readAliasedArg(rawParams, 'sheet_title', 'sheetTitle');
|
|
990
|
+
return isOptional(rawParams.email, 'string') &&
|
|
991
|
+
typeof spreadsheetId === 'string' &&
|
|
992
|
+
isOptional(sheetId, 'number') &&
|
|
993
|
+
isOptional(sheetTitle, 'string') &&
|
|
994
|
+
(sheetId !== undefined || sheetTitle !== undefined) &&
|
|
995
|
+
isOptional(rawParams.title, 'string') &&
|
|
996
|
+
isOptional(rawParams.new_title, 'string') &&
|
|
997
|
+
isOptional(rawParams.position, 'number');
|
|
998
|
+
}
|
|
999
|
+
export function assertDuplicateSpreadsheetSheetArgs(args) {
|
|
1000
|
+
if (!isDuplicateSpreadsheetSheetArgs(args)) {
|
|
1001
|
+
throw new Error('Invalid duplicate spreadsheet sheet parameters. Required: spreadsheet_id, sheet_id (number) or sheet_title (string). Optional: title (string), position (number)');
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
export function isUpdateSpreadsheetSheetArgs(args) {
|
|
1005
|
+
if (typeof args !== 'object' || args === null)
|
|
1006
|
+
return false;
|
|
1007
|
+
const rawParams = args;
|
|
1008
|
+
const spreadsheetId = readAliasedArg(rawParams, 'spreadsheet_id', 'spreadsheetId');
|
|
1009
|
+
const sheetId = readAliasedArg(rawParams, 'sheet_id', 'sheetId');
|
|
1010
|
+
const sheetTitle = readAliasedArg(rawParams, 'sheet_title', 'sheetTitle');
|
|
1011
|
+
return isOptional(rawParams.email, 'string') &&
|
|
1012
|
+
typeof spreadsheetId === 'string' &&
|
|
1013
|
+
isOptional(sheetId, 'number') &&
|
|
1014
|
+
isOptional(sheetTitle, 'string') &&
|
|
1015
|
+
(sheetId !== undefined || sheetTitle !== undefined) &&
|
|
1016
|
+
isOptional(rawParams.title, 'string') &&
|
|
1017
|
+
isOptional(rawParams.new_title, 'string') &&
|
|
1018
|
+
isOptional(rawParams.position, 'number');
|
|
1019
|
+
}
|
|
1020
|
+
export function assertUpdateSpreadsheetSheetArgs(args) {
|
|
1021
|
+
if (!isUpdateSpreadsheetSheetArgs(args)) {
|
|
1022
|
+
throw new Error('Invalid update spreadsheet sheet parameters. Required: spreadsheet_id, sheet_id (number) or sheet_title (string). Optional: title (string), position (number)');
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
export function isInsertSpreadsheetDimensionArgs(args) {
|
|
1026
|
+
if (typeof args !== 'object' || args === null)
|
|
1027
|
+
return false;
|
|
1028
|
+
const rawParams = args;
|
|
1029
|
+
const spreadsheetId = readAliasedArg(rawParams, 'spreadsheet_id', 'spreadsheetId');
|
|
1030
|
+
const sheetId = readAliasedArg(rawParams, 'sheet_id', 'sheetId');
|
|
1031
|
+
const sheetTitle = readAliasedArg(rawParams, 'sheet_title', 'sheetTitle');
|
|
1032
|
+
const startIndex = readAliasedArg(rawParams, 'start_index', 'startIndex');
|
|
1033
|
+
const inheritFrom = readAliasedArg(rawParams, 'inherit_from', 'inheritFrom');
|
|
1034
|
+
return isOptional(rawParams.email, 'string') &&
|
|
1035
|
+
typeof spreadsheetId === 'string' &&
|
|
1036
|
+
isOptional(sheetId, 'number') &&
|
|
1037
|
+
isOptional(sheetTitle, 'string') &&
|
|
1038
|
+
(sheetId !== undefined || sheetTitle !== undefined) &&
|
|
1039
|
+
(rawParams.dimension === 'ROWS' || rawParams.dimension === 'COLUMNS') &&
|
|
1040
|
+
typeof startIndex === 'number' &&
|
|
1041
|
+
isOptional(rawParams.count, 'number') &&
|
|
1042
|
+
(inheritFrom === undefined || inheritFrom === 'before' || inheritFrom === 'after');
|
|
1043
|
+
}
|
|
1044
|
+
export function assertInsertSpreadsheetDimensionArgs(args) {
|
|
1045
|
+
if (!isInsertSpreadsheetDimensionArgs(args)) {
|
|
1046
|
+
throw new Error('Invalid insert dimension parameters. Required: spreadsheet_id, sheet_id (number) or sheet_title (string), dimension ("ROWS" or "COLUMNS"), start_index (number). Optional: count (number), inherit_from ("before" or "after")');
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
865
1049
|
export function isExtractSpreadsheetIdArgs(args) {
|
|
866
1050
|
if (typeof args !== 'object' || args === null)
|
|
867
1051
|
return false;
|
package/dist/tools/types.d.ts
CHANGED
|
@@ -134,7 +134,7 @@ export interface DriveFileListArgs extends BaseToolArguments {
|
|
|
134
134
|
folderId?: string;
|
|
135
135
|
query?: string;
|
|
136
136
|
pageSize?: number;
|
|
137
|
-
orderBy?: string[];
|
|
137
|
+
orderBy?: string | string[];
|
|
138
138
|
fields?: string[];
|
|
139
139
|
driveId?: string;
|
|
140
140
|
corpora?: 'user' | 'drive' | 'allDrives';
|
package/dist/utils/apiError.d.ts
CHANGED
|
@@ -12,6 +12,12 @@ export declare function extractHttpStatus(error: unknown): number | undefined;
|
|
|
12
12
|
* to the user instead of collapsing to "Unknown error".
|
|
13
13
|
*/
|
|
14
14
|
export declare function describeApiError(error: unknown): string;
|
|
15
|
+
/**
|
|
16
|
+
* describeApiError with the error message wrapped as untrusted content (the
|
|
17
|
+
* HTTP status stays outside). Google's error text can quote request or
|
|
18
|
+
* document content, so results that reach the model carry it enveloped.
|
|
19
|
+
*/
|
|
20
|
+
export declare function describeApiErrorUntrusted(error: unknown, source: string): string;
|
|
15
21
|
/**
|
|
16
22
|
* Structural check for this connector's domain error classes (GmailError,
|
|
17
23
|
* CalendarError, ContactsError, GoogleServiceError). They all share a
|
package/dist/utils/apiError.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { wrapUntrustedContent } from './untrusted-content.js';
|
|
2
3
|
/**
|
|
3
4
|
* Extracts the HTTP status from a googleapis (GaxiosError-shaped) failure,
|
|
4
5
|
* preferring `response.status` and falling back to a top-level `status` or a
|
|
@@ -30,6 +31,17 @@ export function describeApiError(error) {
|
|
|
30
31
|
const status = extractHttpStatus(error);
|
|
31
32
|
return status !== undefined ? `${message} (status ${status})` : message;
|
|
32
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* describeApiError with the error message wrapped as untrusted content (the
|
|
36
|
+
* HTTP status stays outside). Google's error text can quote request or
|
|
37
|
+
* document content, so results that reach the model carry it enveloped.
|
|
38
|
+
*/
|
|
39
|
+
export function describeApiErrorUntrusted(error, source) {
|
|
40
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
41
|
+
const status = extractHttpStatus(error);
|
|
42
|
+
const wrapped = wrapUntrustedContent(message, source);
|
|
43
|
+
return status !== undefined ? `${wrapped} (status ${status})` : wrapped;
|
|
44
|
+
}
|
|
33
45
|
/**
|
|
34
46
|
* Structural check for this connector's domain error classes (GmailError,
|
|
35
47
|
* CalendarError, ContactsError, GoogleServiceError). They all share a
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Index arithmetic for moving a tab (a Docs tab or a Sheets sheet) to a new
|
|
3
|
+
* position among its siblings.
|
|
4
|
+
*
|
|
5
|
+
* Both Docs `updateDocumentTabProperties.index` and Sheets
|
|
6
|
+
* `updateSheetProperties.index` count positions *before* the moved item is
|
|
7
|
+
* removed from its current place. Moving a tab forward within the same parent
|
|
8
|
+
* therefore needs one more than the final position (moving A in [A, B, C] to
|
|
9
|
+
* position 1 means index 2; index 1 would be a no-op). Moves backwards, and
|
|
10
|
+
* moves to a different parent, use the final position unchanged.
|
|
11
|
+
*
|
|
12
|
+
* `targetPosition` is the 0-based position the tab should end up at among its
|
|
13
|
+
* destination siblings (not counting the tab itself).
|
|
14
|
+
*/
|
|
15
|
+
export declare function computeMoveApiIndex(args: {
|
|
16
|
+
sameParent: boolean;
|
|
17
|
+
currentIndex: number;
|
|
18
|
+
targetPosition: number;
|
|
19
|
+
}): number;
|
|
20
|
+
//# sourceMappingURL=tabPosition.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Index arithmetic for moving a tab (a Docs tab or a Sheets sheet) to a new
|
|
3
|
+
* position among its siblings.
|
|
4
|
+
*
|
|
5
|
+
* Both Docs `updateDocumentTabProperties.index` and Sheets
|
|
6
|
+
* `updateSheetProperties.index` count positions *before* the moved item is
|
|
7
|
+
* removed from its current place. Moving a tab forward within the same parent
|
|
8
|
+
* therefore needs one more than the final position (moving A in [A, B, C] to
|
|
9
|
+
* position 1 means index 2; index 1 would be a no-op). Moves backwards, and
|
|
10
|
+
* moves to a different parent, use the final position unchanged.
|
|
11
|
+
*
|
|
12
|
+
* `targetPosition` is the 0-based position the tab should end up at among its
|
|
13
|
+
* destination siblings (not counting the tab itself).
|
|
14
|
+
*/
|
|
15
|
+
export function computeMoveApiIndex(args) {
|
|
16
|
+
const { sameParent, currentIndex, targetPosition } = args;
|
|
17
|
+
return sameParent && currentIndex < targetPosition ? targetPosition + 1 : targetPosition;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=tabPosition.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindstone/mcp-server-google-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"mcpName": "io.github.mindstone/mcp-server-google-workspace",
|
|
5
5
|
"description": "Google Workspace MCP server for Gmail, Calendar, Drive, Docs, Sheets, Slides, Contacts, Tasks, and Forms",
|
|
6
6
|
"license": "FSL-1.1-MIT",
|