@mindstone/mcp-server-google-workspace 0.4.2 → 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.
Files changed (39) hide show
  1. package/README.md +43 -5
  2. package/dist/modules/docs/service.d.ts +76 -6
  3. package/dist/modules/docs/service.js +791 -103
  4. package/dist/modules/docs/tabCopy.d.ts +266 -0
  5. package/dist/modules/docs/tabCopy.js +794 -0
  6. package/dist/modules/docs/tabs.d.ts +161 -0
  7. package/dist/modules/docs/tabs.js +416 -0
  8. package/dist/modules/docs/types.d.ts +141 -1
  9. package/dist/modules/drive/service.d.ts +15 -0
  10. package/dist/modules/drive/service.js +77 -2
  11. package/dist/modules/drive/types.d.ts +1 -1
  12. package/dist/modules/sheets/a1Utils.d.ts +13 -0
  13. package/dist/modules/sheets/a1Utils.js +33 -7
  14. package/dist/modules/sheets/formatters.d.ts +33 -2
  15. package/dist/modules/sheets/formatters.js +84 -5
  16. package/dist/modules/sheets/service.d.ts +26 -1
  17. package/dist/modules/sheets/service.js +264 -8
  18. package/dist/modules/sheets/types.d.ts +71 -0
  19. package/dist/modules/sheets/types.js +12 -1
  20. package/dist/modules/sheets/writeGuards.js +2 -2
  21. package/dist/tools/definitions/destructive-overrides.json +8 -0
  22. package/dist/tools/definitions/docs.js +395 -9
  23. package/dist/tools/definitions/drive.js +9 -4
  24. package/dist/tools/definitions/open-world-overrides.json +8 -0
  25. package/dist/tools/definitions/sheets.js +177 -1
  26. package/dist/tools/docs-handlers.d.ts +125 -0
  27. package/dist/tools/docs-handlers.js +397 -15
  28. package/dist/tools/param-normalizer.js +16 -0
  29. package/dist/tools/server.js +35 -3
  30. package/dist/tools/sheets-handlers.d.ts +54 -1
  31. package/dist/tools/sheets-handlers.js +107 -13
  32. package/dist/tools/type-guards.d.ts +89 -0
  33. package/dist/tools/type-guards.js +190 -6
  34. package/dist/tools/types.d.ts +1 -1
  35. package/dist/utils/apiError.d.ts +6 -0
  36. package/dist/utils/apiError.js +12 -0
  37. package/dist/utils/tabPosition.d.ts +20 -0
  38. package/dist/utils/tabPosition.js +19 -0
  39. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ const TAB_LINK_NOTE = 'A Docs link containing ?tab=t.xxxx points at one tab; "t.xxxx" is its tab_id.';
1
2
  // Google Docs Tools
2
3
  export const docsTools = [
3
4
  {
@@ -7,6 +8,16 @@ export const docsTools = [
7
8
 
8
9
  Returns human-readable text by default. Use return_json: true for the raw Google Docs API response.
9
10
 
11
+ Tabs: without tab_id or all_tabs this reads the first tab only. On a document with several
12
+ tabs the result says how many there are and which one is shown. Pass tab_id to read one tab
13
+ (sub-tabs are separate tabs), or all_tabs: true to read every tab in order under
14
+ "## Tab: <path> [tabId: …]" headings; all tabs share one max_chars budget, and tabs past the
15
+ budget are listed by id so you can read them with tab_id. On tab_id / all_tabs reads, smart
16
+ chips, people and dates appear as their text, each list item (bulleted or numbered) starts
17
+ with "• " (indented two spaces per nesting level, so an empty list item shows as a bare "•"),
18
+ and headings start with [H1]…[H6], [Title] or [Subtitle]. These markers are not document
19
+ text: leave them out of anchor_text and find_text. ${TAB_LINK_NOTE}
20
+
10
21
  Usage examples:
11
22
 
12
23
  1. Simple read:
@@ -17,13 +28,21 @@ export const docsTools = [
17
28
 
18
29
  3. Get raw JSON structure:
19
30
  { "email": "user@example.com", "document_id": "1ABC123xyz", "return_json": true }
31
+
32
+ 4. Read one tab:
33
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "tab_id": "t.abc123" }
34
+
35
+ 5. Read every tab:
36
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "all_tabs": true }
20
37
 
21
38
  Response includes:
22
39
  - Document title and URL
23
40
  - Text content (default: up to 50,000 characters)
24
41
  - Truncation indicator if content exceeds limit
25
42
 
26
- Note: For very large documents, consider using max_chars to limit response size.`,
43
+ Note: For very large documents, consider using max_chars to limit response size.
44
+ all_tabs cannot be combined with return_json; tab_id with return_json returns that one tab
45
+ (up to 100,000 characters of JSON; sub-tabs listed by id; named ranges as a list, not keyed by name).`,
27
46
  aliases: ['read_doc', 'get_document', 'view_document'],
28
47
  annotations: { readOnlyHint: true },
29
48
  inputSchema: {
@@ -39,11 +58,19 @@ export const docsTools = [
39
58
  },
40
59
  max_chars: {
41
60
  type: 'number',
42
- description: 'Maximum characters to return (default: 50000)'
61
+ description: 'Maximum characters to return (default: 50000). With all_tabs, one budget shared by all tabs.'
43
62
  },
44
63
  return_json: {
45
64
  type: 'boolean',
46
65
  description: 'Return raw Google Docs API JSON instead of formatted text (default: false)'
66
+ },
67
+ tab_id: {
68
+ type: 'string',
69
+ description: 'Tab id from list_workspace_document_tabs. "default" means the first tab.'
70
+ },
71
+ all_tabs: {
72
+ type: 'boolean',
73
+ description: 'Read every tab, in tree order (default: false). Not with tab_id or return_json.'
47
74
  }
48
75
  },
49
76
  required: ['document_id']
@@ -89,12 +116,18 @@ export const docsTools = [
89
116
  category: 'Docs/Documents',
90
117
  description: `Append text to the end of a Google Docs document.
91
118
 
119
+ Without tab_id this acts on the first tab. Pass tab_id to append to the end of one tab.
120
+ ${TAB_LINK_NOTE}
121
+
92
122
  Usage examples:
93
123
 
94
124
  1. Simple append:
95
125
  { "email": "user@example.com", "document_id": "1ABC123xyz", "text": "\\n\\n## New Section\\n\\nAdditional content here." }
126
+
127
+ 2. Append to one tab:
128
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "tab_id": "t.abc123", "text": "\\nAction items reviewed." }
96
129
 
97
- The text is inserted at the end of the document body.
130
+ The text is inserted at the end of the document body (or of the tab).
98
131
  Use \\n for line breaks in the appended text.`,
99
132
  aliases: ['append_doc', 'add_to_document', 'document_append'],
100
133
  annotations: { readOnlyHint: false, destructiveHint: false },
@@ -112,6 +145,10 @@ export const docsTools = [
112
145
  text: {
113
146
  type: 'string',
114
147
  description: 'Text to append to the document'
148
+ },
149
+ tab_id: {
150
+ type: 'string',
151
+ description: 'Tab id from list_workspace_document_tabs. "default" means the first tab.'
115
152
  }
116
153
  },
117
154
  required: ['document_id', 'text']
@@ -124,12 +161,19 @@ export const docsTools = [
124
161
 
125
162
  WARNING: This completely replaces all existing content. Use with caution.
126
163
 
164
+ Without tab_id this acts on the first tab. Pass tab_id to replace the content of one tab only
165
+ (its sub-tabs are separate tabs and are not touched). ${TAB_LINK_NOTE}
166
+
127
167
  Usage examples:
128
168
 
129
169
  1. Complete rewrite:
130
170
  { "email": "user@example.com", "document_id": "1ABC123xyz", "content": "# New Document Content\\n\\nThis replaces everything." }
171
+
172
+ 2. Rewrite one tab:
173
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "tab_id": "t.abc123", "content": "Agenda\\n\\n- Updates" }
131
174
 
132
- For partial edits, consider using find_and_replace_workspace_document instead.`,
175
+ For partial edits, consider using find_and_replace_workspace_document instead. To reset a tab
176
+ from a template tab while keeping formatting, use copy_workspace_document_tab instead.`,
133
177
  aliases: ['replace_doc', 'overwrite_document', 'rewrite_document'],
134
178
  annotations: { readOnlyHint: false, destructiveHint: false },
135
179
  inputSchema: {
@@ -146,6 +190,10 @@ export const docsTools = [
146
190
  content: {
147
191
  type: 'string',
148
192
  description: 'New content to replace entire document'
193
+ },
194
+ tab_id: {
195
+ type: 'string',
196
+ description: 'Tab id from list_workspace_document_tabs. "default" means the first tab.'
149
197
  }
150
198
  },
151
199
  required: ['document_id', 'content']
@@ -156,6 +204,9 @@ export const docsTools = [
156
204
  category: 'Docs/Documents',
157
205
  description: `Find and replace text throughout a Google Docs document.
158
206
 
207
+ Without tab_id this replaces in every tab; pass tab_id to limit it to one tab (sub-tabs are
208
+ separate tabs and are not included). ${TAB_LINK_NOTE}
209
+
159
210
  Usage examples:
160
211
 
161
212
  1. Simple replacement:
@@ -163,9 +214,13 @@ export const docsTools = [
163
214
 
164
215
  2. Case-sensitive replacement:
165
216
  { "email": "user@example.com", "document_id": "1ABC123xyz", "find_text": "TODO", "replace_text": "DONE", "match_case": true }
217
+
218
+ 3. Replace a date placeholder in one tab only:
219
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "tab_id": "t.abc123", "find_text": "{{date}}", "replace_text": "2031-10-13" }
220
+ Without tab_id a placeholder that also sits in a Template tab is replaced there too.
166
221
 
167
222
  Returns the number of occurrences replaced.
168
- Note: This replaces ALL occurrences of the text in the document.`,
223
+ Note: This replaces ALL occurrences of the text in every tab it covers.`,
169
224
  aliases: ['find_replace_doc', 'search_replace_document', 'document_find_replace'],
170
225
  annotations: { readOnlyHint: false, destructiveHint: false },
171
226
  inputSchema: {
@@ -190,6 +245,10 @@ export const docsTools = [
190
245
  match_case: {
191
246
  type: 'boolean',
192
247
  description: 'Case-sensitive matching (default: false)'
248
+ },
249
+ tab_id: {
250
+ type: 'string',
251
+ description: 'Tab id from list_workspace_document_tabs. "default" means the first tab.'
193
252
  }
194
253
  },
195
254
  required: ['document_id', 'find_text', 'replace_text']
@@ -233,10 +292,17 @@ export const docsTools = [
233
292
  {
234
293
  name: 'list_workspace_document_tabs',
235
294
  category: 'Docs/Documents',
236
- description: `List tabs in a Google Docs document.
295
+ description: `List every tab in a Google Docs document, including nested sub-tabs.
237
296
 
238
- Note: Full tab support requires a googleapis library upgrade.
239
- Currently returns the main document body as a single "default" tab.
297
+ Returns the tab tree: one line per tab, indented by nesting level and numbered by position
298
+ (1., 1.1., 1.1.1.), with its tab id and number of sub-tabs. Use a tab id as:
299
+ - tab_id in read_workspace_document, append_to_workspace_document, replace_workspace_document,
300
+ find_and_replace_workspace_document and insert_workspace_document_text;
301
+ - parent_tab_id in add_workspace_document_tab and update_workspace_document_tab (nest a tab);
302
+ - tab_id in update_workspace_document_tab and delete_workspace_document_tab (rename, move or
303
+ delete a tab);
304
+ - source_tab_id, target_tab_id or new_tab_parent_id in copy_workspace_document_tab.
305
+ The list numbers start at 1; the position arguments of the tab tools start at 0. ${TAB_LINK_NOTE}
240
306
 
241
307
  Usage examples:
242
308
 
@@ -245,8 +311,12 @@ export const docsTools = [
245
311
 
246
312
  2. Include word count:
247
313
  { "email": "user@example.com", "document_id": "1ABC123xyz", "include_word_count": true }
314
+
315
+ 3. As JSON (flat list in tree order with tabId, title, parentTabId, index, nestingLevel, path, childCount):
316
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "return_json": true }
248
317
 
249
- Returns tab information including title and optional word count.`,
318
+ Returns tab information including title and optional word count. include_word_count reads
319
+ every tab's content, so it is slower on large documents.`,
250
320
  aliases: ['list_doc_tabs', 'get_document_tabs', 'document_tabs'],
251
321
  annotations: { readOnlyHint: true },
252
322
  inputSchema: {
@@ -263,6 +333,10 @@ export const docsTools = [
263
333
  include_word_count: {
264
334
  type: 'boolean',
265
335
  description: 'Include word count for each tab (default: false)'
336
+ },
337
+ return_json: {
338
+ type: 'boolean',
339
+ description: 'Return the tab list as JSON instead of formatted text (default: false)'
266
340
  }
267
341
  },
268
342
  required: ['document_id']
@@ -411,6 +485,318 @@ export const docsTools = [
411
485
  },
412
486
  required: ['document_id', 'requests']
413
487
  }
488
+ },
489
+ {
490
+ name: 'add_workspace_document_tab',
491
+ category: 'Docs/Documents',
492
+ description: `Add a new, empty tab to a Google Docs document, at the top level or as a sub-tab.
493
+
494
+ Tab titles must be unique across the whole document, including sub-tabs; a title that is
495
+ already used is refused before anything changes. Without position the tab goes last among
496
+ its siblings. Returns the new tab's id and where it ended up. ${TAB_LINK_NOTE}
497
+
498
+ position is 0-based among the new tab's siblings: 0 = first; the numbers in list outputs
499
+ start at 1.
500
+
501
+ Usage examples:
502
+
503
+ 1. Add a top-level tab at the end:
504
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "title": "Q4 planning" }
505
+
506
+ 2. Add a sub-tab as the first child of another tab:
507
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "title": "Archive 2031-10-06", "parent_tab_id": "t.abc123", "position": 0 }`,
508
+ aliases: ['add_doc_tab', 'create_document_tab', 'new_document_tab'],
509
+ annotations: { readOnlyHint: false, destructiveHint: true },
510
+ inputSchema: {
511
+ type: 'object',
512
+ properties: {
513
+ email: {
514
+ type: 'string',
515
+ description: 'Email address of the Google account'
516
+ },
517
+ document_id: {
518
+ type: 'string',
519
+ description: 'Google Docs document ID'
520
+ },
521
+ title: {
522
+ type: 'string',
523
+ description: 'Title of the new tab (unique in the document, sub-tabs included)'
524
+ },
525
+ parent_tab_id: {
526
+ type: 'string',
527
+ description: 'Tab id to nest the new tab under (from list_workspace_document_tabs; "default" means the first tab). Omit for a top-level tab.'
528
+ },
529
+ position: {
530
+ type: 'number',
531
+ description: 'Where the tab goes among its siblings: 0 = first; the numbers in list outputs start at 1. Default: last.'
532
+ }
533
+ },
534
+ required: ['document_id', 'title']
535
+ }
536
+ },
537
+ {
538
+ name: 'update_workspace_document_tab',
539
+ category: 'Docs/Documents',
540
+ description: `Rename a tab and/or move it in a Google Docs document: reorder it among its siblings
541
+ or nest it under another tab. A moved tab takes its sub-tabs with it. The API can't move a
542
+ sub-tab back to the top level; re-create it there instead if needed.
543
+
544
+ position is where the tab should end up (0 = first) among its siblings after the move; the
545
+ numbers in list outputs start at 1. When nesting under another tab without position, the tab
546
+ goes last. Titles must stay unique across the document. Needs a real tab id: "default" is
547
+ refused. The result reports the tab's actual parent and position after the change.
548
+ ${TAB_LINK_NOTE}
549
+
550
+ Usage examples:
551
+
552
+ 1. Rename:
553
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "tab_id": "t.abc123", "title": "Archive 2031-10-06" }
554
+
555
+ 2. Reorder (make it the first of its siblings):
556
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "tab_id": "t.abc123", "position": 0 }
557
+
558
+ 3. Nest under another tab, as its first sub-tab:
559
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "tab_id": "t.abc123", "parent_tab_id": "t.def456", "position": 0 }`,
560
+ aliases: ['rename_doc_tab', 'move_doc_tab', 'reorder_document_tab'],
561
+ annotations: { readOnlyHint: false, destructiveHint: true },
562
+ inputSchema: {
563
+ type: 'object',
564
+ properties: {
565
+ email: {
566
+ type: 'string',
567
+ description: 'Email address of the Google account'
568
+ },
569
+ document_id: {
570
+ type: 'string',
571
+ description: 'Google Docs document ID'
572
+ },
573
+ tab_id: {
574
+ type: 'string',
575
+ description: 'Tab id from list_workspace_document_tabs ("default" is not accepted)'
576
+ },
577
+ title: {
578
+ type: 'string',
579
+ description: 'New title (unique in the document, sub-tabs included)'
580
+ },
581
+ parent_tab_id: {
582
+ type: 'string',
583
+ description: 'Tab id to nest this tab under ("default" is not accepted)'
584
+ },
585
+ position: {
586
+ type: 'number',
587
+ description: 'Final position among the siblings after the move: 0 = first; the numbers in list outputs start at 1.'
588
+ }
589
+ },
590
+ required: ['document_id', 'tab_id']
591
+ }
592
+ },
593
+ {
594
+ name: 'delete_workspace_document_tab',
595
+ category: 'Docs/Documents',
596
+ description: `WARNING: Deletes the tab AND ALL ITS SUB-TABS, with their content.
597
+
598
+ This cannot be undone through the API (the document's version history in Google Docs can
599
+ restore it). Read the tab, or copy what you need, first. Needs a real tab id: "default" is
600
+ refused. A tab that has sub-tabs is refused, before anything is deleted, unless you pass
601
+ delete_sub_tabs: true; the refusal says how many sub-tabs it has. Check the id against
602
+ list_workspace_document_tabs first: deleting a parent tab by mistake deletes everything
603
+ under it. The result lists every sub-tab that was deleted with it. ${TAB_LINK_NOTE}
604
+
605
+ Usage examples:
606
+
607
+ 1. Delete a tab with no sub-tabs:
608
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "tab_id": "t.old789" }
609
+
610
+ 2. Delete a tab together with its sub-tabs:
611
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "tab_id": "t.drafts42", "delete_sub_tabs": true }`,
612
+ aliases: ['delete_doc_tab', 'remove_document_tab'],
613
+ annotations: { readOnlyHint: false, destructiveHint: true },
614
+ inputSchema: {
615
+ type: 'object',
616
+ properties: {
617
+ email: {
618
+ type: 'string',
619
+ description: 'Email address of the Google account'
620
+ },
621
+ document_id: {
622
+ type: 'string',
623
+ description: 'Google Docs document ID'
624
+ },
625
+ tab_id: {
626
+ type: 'string',
627
+ description: 'Tab id from list_workspace_document_tabs ("default" is not accepted)'
628
+ },
629
+ delete_sub_tabs: {
630
+ type: 'boolean',
631
+ description: 'Also delete every sub-tab below this tab (default: false). Required when the tab has sub-tabs.'
632
+ }
633
+ },
634
+ required: ['document_id', 'tab_id']
635
+ }
636
+ },
637
+ {
638
+ name: 'insert_workspace_document_text',
639
+ category: 'Docs/Documents',
640
+ description: `Insert plain text next to a unique piece of text in one tab, without rewriting the tab.
641
+
642
+ anchor_text must appear exactly once in the tab and sit inside one paragraph (smart chips,
643
+ people and dates can't be part of it); copy it exactly from a tab_id read, without the "• "
644
+ and [H1]-style markers. position:
645
+ - "after" (default): right after the anchor text.
646
+ - "before": right before the anchor text.
647
+ - "next_paragraph_start": at the start of the paragraph that follows the anchor's paragraph.
648
+ Use this to fill the (often empty) list item under a heading. Anchor on the line directly
649
+ above the slot you want to fill: if an instruction line sits between the heading and the
650
+ empty bullet, anchor on the instruction line, not on the heading. Here the paragraph must
651
+ be empty or the call is refused (expect_empty_paragraph defaults to true); pass
652
+ expect_empty_paragraph: false to insert at the start of a non-empty paragraph.
653
+
654
+ Newlines in text start new paragraphs that take the formatting (heading, bullet, numbering)
655
+ of the paragraph the text lands in. The inserted text is plain: it does not pick up bold,
656
+ links or other character styles from its neighbours, and people or date chips you include
657
+ arrive as plain text. Line endings become \\n; control and private-use characters, which
658
+ Google Docs can't store, are left out (the result says how many). End text with a newline
659
+ when inserting whole lines ahead of a non-empty paragraph. expect_empty_paragraph: true
660
+ also works with "after" and "before". Without tab_id this acts on the first tab. To change
661
+ existing text use find_and_replace_workspace_document. ${TAB_LINK_NOTE}
662
+
663
+ Usage examples:
664
+
665
+ 1. Fill the empty bullet under an "Out of office" heading with two lines (two bullets). The
666
+ tab reads "[H2] Out of office", then "List anyone away next week:", then an empty "•",
667
+ so the anchor is the instruction line directly above the bullet:
668
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "tab_id": "t.abc123", "anchor_text": "List anyone away next week:", "position": "next_paragraph_start", "text": "Jane: Oct 20-24\\nSam: Oct 27" }
669
+
670
+ 2. Insert a sentence after a phrase:
671
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "tab_id": "t.abc123", "anchor_text": "Budget approved.", "text": " Next review in November." }`,
672
+ aliases: ['insert_doc_text', 'insert_text_at_anchor'],
673
+ annotations: { readOnlyHint: false, destructiveHint: true },
674
+ inputSchema: {
675
+ type: 'object',
676
+ properties: {
677
+ email: {
678
+ type: 'string',
679
+ description: 'Email address of the Google account'
680
+ },
681
+ document_id: {
682
+ type: 'string',
683
+ description: 'Google Docs document ID'
684
+ },
685
+ tab_id: {
686
+ type: 'string',
687
+ description: 'Tab id from list_workspace_document_tabs. "default" means the first tab.'
688
+ },
689
+ anchor_text: {
690
+ type: 'string',
691
+ description: 'Text that appears exactly once in the tab, inside one paragraph (one line)'
692
+ },
693
+ position: {
694
+ type: 'string',
695
+ enum: ['after', 'before', 'next_paragraph_start'],
696
+ description: 'Where to insert relative to the anchor (default: "after")'
697
+ },
698
+ text: {
699
+ type: 'string',
700
+ description: 'Plain text to insert; \\n starts a new paragraph'
701
+ },
702
+ match_case: {
703
+ type: 'boolean',
704
+ description: 'Case-sensitive anchor matching (default: true)'
705
+ },
706
+ expect_empty_paragraph: {
707
+ type: 'boolean',
708
+ description: 'Refuse unless the paragraph the text lands in is empty (default: true for "next_paragraph_start", false otherwise)'
709
+ }
710
+ },
711
+ required: ['document_id', 'anchor_text', 'text']
712
+ }
713
+ },
714
+ {
715
+ name: 'copy_workspace_document_tab',
716
+ category: 'Docs/Documents',
717
+ description: `Copy one tab's content, with its formatting, into another tab of the same Google Docs document.
718
+
719
+ Copies text, heading and paragraph styles, character styles including links, bullets and
720
+ numbering (mapped to Google Docs' preset list styles), tables (cell text, column widths, cell
721
+ styles), page breaks and smart chips. A smart chip linking to a file you can't open becomes a
722
+ titled link, and people and date chips become their text; the result lists both. Does NOT copy
723
+ headers and footers, sub-tabs, images (inline or floating) or other special elements: those
724
+ are listed under "Not copied" (inline ones also leave a visible "[placeholder]"). Merged table
725
+ cells are copied unmerged, and a table whose merged cells can't be copied is refused before
726
+ anything is written. Links to headings inside the copied tab still point at the source tab's
727
+ headings, so after the source is reset they no longer lead anywhere.
728
+
729
+ Pass exactly one of target_tab_id or new_tab_title. new_tab_parent_id and new_tab_position only
730
+ apply with new_tab_title.
731
+
732
+ Which target: to archive or duplicate a tab, use new_tab_title. To reset a tab in place from a
733
+ template (keeping its id, position and sub-tabs), use target_tab_id with overwrite_existing:
734
+ true, which clears the tab first. Never delete a tab in order to replace it: deleting also
735
+ deletes its sub-tabs. target_tab_id needs a real tab id ("default" is refused);
736
+ source_tab_id and new_tab_parent_id accept "default" for the first tab.
737
+
738
+ The copy is not atomic. The result starts with a "Verification:" line that compares text,
739
+ heading types, paragraph formatting, bullets, list grouping and table shapes with the source.
740
+ Before deleting or resetting the source, check both that it says "passed" and that what the
741
+ "Not copied" line lists (floating images, for example) is acceptable to lose: verification
742
+ can pass while those are missing. A failed verification comes back as an error, with the full
743
+ report. If the copy stops part-way, the connector tries to delete a new tab again and the
744
+ result says whether that worked (if not, it names the tab to delete); an existing tab may be
745
+ left cleared or partly written (the document's version history can restore it). If the copy
746
+ completes but verification finds differences, the tab is kept so it can be checked, and the
747
+ result is an error listing the first few places it differs. Long tabs can take 10-60 seconds.
748
+ ${TAB_LINK_NOTE}
749
+
750
+ new_tab_position is 0-based among the new tab's siblings: 0 = first; the numbers in list
751
+ outputs start at 1.
752
+
753
+ Usage examples:
754
+
755
+ 1. Archive the live tab into a new first sub-tab titled with this week's date:
756
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "source_tab_id": "t.live01", "new_tab_title": "2031-10-13", "new_tab_parent_id": "t.live01", "new_tab_position": 0 }
757
+
758
+ 2. Reset the live tab from the Template tab (clears it first):
759
+ { "email": "user@example.com", "document_id": "1ABC123xyz", "source_tab_id": "t.tmpl02", "target_tab_id": "t.live01", "overwrite_existing": true }`,
760
+ aliases: ['copy_doc_tab', 'duplicate_document_tab', 'clone_document_tab'],
761
+ annotations: { readOnlyHint: false, destructiveHint: true },
762
+ inputSchema: {
763
+ type: 'object',
764
+ properties: {
765
+ email: {
766
+ type: 'string',
767
+ description: 'Email address of the Google account'
768
+ },
769
+ document_id: {
770
+ type: 'string',
771
+ description: 'Google Docs document ID'
772
+ },
773
+ source_tab_id: {
774
+ type: 'string',
775
+ description: 'Tab to copy from (list_workspace_document_tabs). "default" means the first tab. Its sub-tabs are not copied.'
776
+ },
777
+ target_tab_id: {
778
+ type: 'string',
779
+ description: 'Existing tab to copy into; it is cleared first and needs overwrite_existing: true ("default" is not accepted). Not with new_tab_title.'
780
+ },
781
+ overwrite_existing: {
782
+ type: 'boolean',
783
+ description: 'Confirms that target_tab_id will be cleared and overwritten (required with target_tab_id).'
784
+ },
785
+ new_tab_title: {
786
+ type: 'string',
787
+ description: 'Title for a new tab to copy into (unique in the document, sub-tabs included). Not with target_tab_id.'
788
+ },
789
+ new_tab_parent_id: {
790
+ type: 'string',
791
+ description: 'With new_tab_title: tab to nest the new tab under ("default" means the first tab). Omit for a top-level tab.'
792
+ },
793
+ new_tab_position: {
794
+ type: 'number',
795
+ description: 'With new_tab_title: where the new tab goes among its siblings: 0 = first; the numbers in list outputs start at 1. Default: last.'
796
+ }
797
+ },
798
+ required: ['document_id', 'source_tab_id']
799
+ }
414
800
  }
415
801
  ];
416
802
  //# sourceMappingURL=docs.js.map
@@ -24,11 +24,14 @@ export const driveTools = [
24
24
  5. Get JSON output:
25
25
  { "email": "user@example.com", "return_json": true }
26
26
 
27
+ 6. Most recently modified first:
28
+ { "email": "user@example.com", "options": { "orderBy": "modifiedTime desc", "pageSize": 10 } }
29
+
27
30
  Parameters (all inside "options"):
28
31
  - folderId: List contents of specific folder
29
32
  - query: Drive API query string
30
33
  - pageSize: Number of files to return
31
- - orderBy: Sort order fields
34
+ - orderBy: Sort order, e.g. "modifiedTime desc" or ["folder", "name"] (Drive API orderBy keys)
32
35
  - driveId: Limit results to one shared drive (corpora is forced to 'drive')
33
36
  - corpora: 'user' (default), 'drive', or 'allDrives' (My Drive + every shared drive)`,
34
37
  aliases: ['list_files', 'get_files', 'show_files'],
@@ -56,9 +59,11 @@ export const driveTools = [
56
59
  description: 'Maximum number of files to return'
57
60
  },
58
61
  orderBy: {
59
- type: 'array',
60
- items: { type: 'string' },
61
- description: 'Sort order fields'
62
+ oneOf: [
63
+ { type: 'string' },
64
+ { type: 'array', items: { type: 'string' } }
65
+ ],
66
+ description: 'Sort order, e.g. "modifiedTime desc" or ["folder", "name"] (Drive API orderBy keys)'
62
67
  },
63
68
  fields: {
64
69
  type: 'array',
@@ -1,4 +1,5 @@
1
1
  {
2
+ "add_workspace_document_tab": true,
2
3
  "add_workspace_spreadsheet_sheet": true,
3
4
  "append_to_workspace_document": true,
4
5
  "append_to_workspace_spreadsheet": true,
@@ -12,6 +13,7 @@
12
13
  "complete_task": true,
13
14
  "compose_workspace_email": true,
14
15
  "copy_drive_file": true,
16
+ "copy_workspace_document_tab": true,
15
17
  "create_drive_folder": true,
16
18
  "create_task": true,
17
19
  "create_workspace_calendar_event": true,
@@ -28,6 +30,7 @@
28
30
  "delete_workspace_attachment": true,
29
31
  "delete_workspace_calendar_event": true,
30
32
  "delete_workspace_comment": true,
33
+ "delete_workspace_document_tab": true,
31
34
  "delete_workspace_draft": true,
32
35
  "delete_workspace_label": true,
33
36
  "delete_workspace_label_filter": true,
@@ -35,6 +38,7 @@
35
38
  "download_drive_file": true,
36
39
  "download_file_revision": true,
37
40
  "download_workspace_attachment": true,
41
+ "duplicate_workspace_spreadsheet_sheet": true,
38
42
  "extract_workspace_document_id": true,
39
43
  "extract_workspace_presentation_id": true,
40
44
  "extract_workspace_spreadsheet_id": true,
@@ -54,6 +58,8 @@
54
58
  "get_workspace_label": true,
55
59
  "get_workspace_slide": true,
56
60
  "get_workspace_slide_thumbnail": true,
61
+ "insert_workspace_document_text": true,
62
+ "insert_workspace_spreadsheet_dimension": true,
57
63
  "list_chat_messages": true,
58
64
  "list_chat_spaces": true,
59
65
  "list_drive_files": true,
@@ -108,9 +114,11 @@
108
114
  "update_drive_permissions": true,
109
115
  "update_task": true,
110
116
  "update_workspace_contact": true,
117
+ "update_workspace_document_tab": true,
111
118
  "update_workspace_draft": true,
112
119
  "update_workspace_label": true,
113
120
  "update_workspace_label_filter": true,
121
+ "update_workspace_spreadsheet_sheet": true,
114
122
  "update_workspace_spreadsheet_values": true,
115
123
  "update_workspace_vacation_responder": true,
116
124
  "upload_drive_file": true,