@alanse/mcp-server-google-workspace 1.0.0 → 1.0.2

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 (155) hide show
  1. package/README.md +146 -17
  2. package/dist/auth.js +5 -0
  3. package/dist/lib/calendar-helpers.js +197 -0
  4. package/dist/lib/drive-helpers.js +263 -0
  5. package/dist/lib/gmail-helpers.js +204 -0
  6. package/dist/tools/calendar/acl/calendar_acl_insert.js +80 -0
  7. package/dist/tools/calendar/acl/calendar_acl_list.js +82 -0
  8. package/dist/tools/calendar/basic/calendar_create_event.js +113 -0
  9. package/dist/tools/calendar/basic/calendar_delete_event.js +52 -0
  10. package/dist/tools/calendar/basic/calendar_get_event.js +52 -0
  11. package/dist/tools/calendar/basic/calendar_list_events.js +86 -0
  12. package/dist/tools/calendar/basic/calendar_update_event.js +116 -0
  13. package/dist/tools/calendar/calendarlist/calendar_calendarlist_get.js +73 -0
  14. package/dist/tools/calendar/calendarlist/calendar_calendarlist_list.js +87 -0
  15. package/dist/tools/calendar/calendars/calendar_calendars_get.js +52 -0
  16. package/dist/tools/calendar/calendars/calendar_calendars_insert.js +66 -0
  17. package/dist/tools/calendar/calendars/calendar_calendars_update.js +85 -0
  18. package/dist/tools/calendar/colors/calendar_colors_get.js +46 -0
  19. package/dist/tools/calendar/events_advanced/calendar_events_instances.js +81 -0
  20. package/dist/tools/calendar/events_advanced/calendar_events_move.js +63 -0
  21. package/dist/tools/calendar/events_advanced/calendar_events_quickadd.js +52 -0
  22. package/dist/tools/calendar/freebusy/calendar_freebusy_query.js +69 -0
  23. package/dist/tools/calendar/settings/calendar_settings_list.js +81 -0
  24. package/dist/tools/drive/advanced/drive_empty_trash.js +56 -0
  25. package/dist/tools/drive/advanced/drive_export_file.js +158 -0
  26. package/dist/tools/drive/advanced/drive_list_revisions.js +80 -0
  27. package/dist/tools/drive/basic/drive_get_metadata.js +49 -0
  28. package/dist/tools/drive/basic/drive_list_files.js +76 -0
  29. package/dist/tools/drive/file/drive_copy_file.js +79 -0
  30. package/dist/tools/drive/file/drive_create_file.js +72 -0
  31. package/dist/tools/drive/file/drive_delete_file.js +48 -0
  32. package/dist/tools/drive/file/drive_move_file.js +79 -0
  33. package/dist/tools/drive/file/drive_rename_file.js +58 -0
  34. package/dist/tools/drive/file/drive_update_file.js +106 -0
  35. package/dist/tools/drive/file/drive_upload_file.js +80 -0
  36. package/dist/tools/drive/folder/drive_create_folder.js +67 -0
  37. package/dist/tools/drive/folder/drive_list_folder_contents.js +68 -0
  38. package/dist/tools/drive/folder/drive_move_to_folder.js +59 -0
  39. package/dist/tools/drive/permissions/drive_list_permissions.js +115 -0
  40. package/dist/tools/drive/permissions/drive_remove_permission.js +71 -0
  41. package/dist/tools/drive/permissions/drive_share_file.js +116 -0
  42. package/dist/tools/drive/permissions/drive_update_permission.js +79 -0
  43. package/dist/tools/gmail/basic/gmail_get_message.js +95 -0
  44. package/dist/tools/gmail/basic/gmail_get_thread.js +46 -0
  45. package/dist/tools/gmail/basic/gmail_list_labels.js +54 -0
  46. package/dist/tools/gmail/basic/gmail_search_messages.js +59 -0
  47. package/dist/tools/gmail/batch/gmail_batch_modify_labels.js +74 -0
  48. package/dist/tools/gmail/batch/gmail_get_messages_batch.js +120 -0
  49. package/dist/tools/gmail/batch/gmail_get_threads_batch.js +102 -0
  50. package/dist/tools/gmail/labels/gmail_manage_label.js +131 -0
  51. package/dist/tools/gmail/labels/gmail_modify_labels.js +65 -0
  52. package/dist/tools/gmail/send/gmail_draft_message.js +117 -0
  53. package/dist/tools/gmail/send/gmail_send_message.js +109 -0
  54. package/dist/tools/index.js +267 -3
  55. package/package.json +8 -3
  56. package/dist/tools/basic/gsheets_add_sheet.js +0 -65
  57. package/dist/tools/basic/gsheets_copy_sheet.js +0 -56
  58. package/dist/tools/basic/gsheets_copy_to.js +0 -113
  59. package/dist/tools/basic/gsheets_create_spreadsheet.js +0 -88
  60. package/dist/tools/basic/gsheets_delete_columns.js +0 -69
  61. package/dist/tools/basic/gsheets_delete_rows.js +0 -69
  62. package/dist/tools/basic/gsheets_delete_sheet.js +0 -56
  63. package/dist/tools/basic/gsheets_duplicate_sheet.js +0 -72
  64. package/dist/tools/basic/gsheets_insert_columns.js +0 -69
  65. package/dist/tools/basic/gsheets_insert_rows.js +0 -69
  66. package/dist/tools/basic/gsheets_list_sheets.js +0 -53
  67. package/dist/tools/basic/gsheets_read.js +0 -120
  68. package/dist/tools/basic/gsheets_rename_sheet.js +0 -64
  69. package/dist/tools/charts/gsheets_add_bubble.js +0 -176
  70. package/dist/tools/charts/gsheets_add_candlestick.js +0 -192
  71. package/dist/tools/charts/gsheets_add_chart.js +0 -162
  72. package/dist/tools/charts/gsheets_add_combo.js +0 -169
  73. package/dist/tools/charts/gsheets_add_histogram.js +0 -143
  74. package/dist/tools/charts/gsheets_add_org_chart.js +0 -160
  75. package/dist/tools/charts/gsheets_add_treemap.js +0 -177
  76. package/dist/tools/charts/gsheets_add_waterfall.js +0 -155
  77. package/dist/tools/charts/gsheets_delete_chart.js +0 -56
  78. package/dist/tools/charts/gsheets_update_chart.js +0 -118
  79. package/dist/tools/data/gsheets_append_data.js +0 -68
  80. package/dist/tools/data/gsheets_batch_clear.js +0 -53
  81. package/dist/tools/data/gsheets_batch_update.js +0 -81
  82. package/dist/tools/data/gsheets_clear_data.js +0 -53
  83. package/dist/tools/data/gsheets_create_filter.js +0 -81
  84. package/dist/tools/data/gsheets_find_replace.js +0 -124
  85. package/dist/tools/data/gsheets_set_data_validation.js +0 -153
  86. package/dist/tools/data/gsheets_sort_range.js +0 -102
  87. package/dist/tools/data/gsheets_update_cell.js +0 -44
  88. package/dist/tools/formatting/gsheets_auto_resize.js +0 -75
  89. package/dist/tools/formatting/gsheets_format_cells.js +0 -161
  90. package/dist/tools/formatting/gsheets_freeze_columns.js +0 -67
  91. package/dist/tools/formatting/gsheets_freeze_rows.js +0 -67
  92. package/dist/tools/formatting/gsheets_merge_cells.js +0 -85
  93. package/dist/tools/formatting/gsheets_set_number_format.js +0 -116
  94. package/dist/tools/formatting/gsheets_unmerge_cells.js +0 -79
  95. package/dist/tools/formatting/gsheets_update_borders.js +0 -212
  96. package/dist/tools/gdrive/gdrive_read_file.js +0 -77
  97. package/dist/tools/gdrive/gdrive_search.js +0 -71
  98. package/dist/tools/gdrive_read_file.js +0 -77
  99. package/dist/tools/gdrive_search.js +0 -71
  100. package/dist/tools/gsheets_add_bubble.js +0 -176
  101. package/dist/tools/gsheets_add_candlestick.js +0 -192
  102. package/dist/tools/gsheets_add_chart.js +0 -162
  103. package/dist/tools/gsheets_add_combo.js +0 -169
  104. package/dist/tools/gsheets_add_conditional_format.js +0 -175
  105. package/dist/tools/gsheets_add_histogram.js +0 -143
  106. package/dist/tools/gsheets_add_named_range.js +0 -87
  107. package/dist/tools/gsheets_add_org_chart.js +0 -160
  108. package/dist/tools/gsheets_add_protected_range.js +0 -127
  109. package/dist/tools/gsheets_add_sheet.js +0 -65
  110. package/dist/tools/gsheets_add_treemap.js +0 -177
  111. package/dist/tools/gsheets_add_waterfall.js +0 -155
  112. package/dist/tools/gsheets_append_data.js +0 -68
  113. package/dist/tools/gsheets_auto_resize.js +0 -75
  114. package/dist/tools/gsheets_batch_clear.js +0 -53
  115. package/dist/tools/gsheets_batch_update.js +0 -81
  116. package/dist/tools/gsheets_clear_data.js +0 -53
  117. package/dist/tools/gsheets_copy_sheet.js +0 -56
  118. package/dist/tools/gsheets_copy_to.js +0 -113
  119. package/dist/tools/gsheets_create_filter.js +0 -81
  120. package/dist/tools/gsheets_create_spreadsheet.js +0 -88
  121. package/dist/tools/gsheets_delete_chart.js +0 -56
  122. package/dist/tools/gsheets_delete_columns.js +0 -69
  123. package/dist/tools/gsheets_delete_named_range.js +0 -56
  124. package/dist/tools/gsheets_delete_protected_range.js +0 -56
  125. package/dist/tools/gsheets_delete_rows.js +0 -69
  126. package/dist/tools/gsheets_delete_sheet.js +0 -56
  127. package/dist/tools/gsheets_duplicate_sheet.js +0 -72
  128. package/dist/tools/gsheets_find_replace.js +0 -124
  129. package/dist/tools/gsheets_format_cells.js +0 -161
  130. package/dist/tools/gsheets_freeze_columns.js +0 -67
  131. package/dist/tools/gsheets_freeze_rows.js +0 -67
  132. package/dist/tools/gsheets_insert_columns.js +0 -69
  133. package/dist/tools/gsheets_insert_rows.js +0 -69
  134. package/dist/tools/gsheets_list_sheets.js +0 -53
  135. package/dist/tools/gsheets_merge_cells.js +0 -85
  136. package/dist/tools/gsheets_read.js +0 -120
  137. package/dist/tools/gsheets_rename_sheet.js +0 -64
  138. package/dist/tools/gsheets_set_data_validation.js +0 -153
  139. package/dist/tools/gsheets_set_number_format.js +0 -116
  140. package/dist/tools/gsheets_sort_range.js +0 -102
  141. package/dist/tools/gsheets_unmerge_cells.js +0 -79
  142. package/dist/tools/gsheets_update_borders.js +0 -212
  143. package/dist/tools/gsheets_update_cell.js +0 -44
  144. package/dist/tools/gsheets_update_chart.js +0 -118
  145. package/dist/tools/gsheets_update_named_range.js +0 -112
  146. package/dist/tools/gsheets_update_protected_range.js +0 -110
  147. package/dist/tools/protection/gsheets_add_conditional_format.js +0 -175
  148. package/dist/tools/protection/gsheets_add_named_range.js +0 -87
  149. package/dist/tools/protection/gsheets_add_protected_range.js +0 -127
  150. package/dist/tools/protection/gsheets_delete_named_range.js +0 -56
  151. package/dist/tools/protection/gsheets_delete_protected_range.js +0 -56
  152. package/dist/tools/protection/gsheets_update_named_range.js +0 -112
  153. package/dist/tools/protection/gsheets_update_protected_range.js +0 -110
  154. /package/dist/tools/drive/{drive_read_file.js → basic/drive_read_file.js} +0 -0
  155. /package/dist/tools/drive/{drive_search.js → basic/drive_search.js} +0 -0
@@ -1,155 +0,0 @@
1
- import { google } from "googleapis";
2
- export const schema = {
3
- name: "gsheets_add_waterfall",
4
- description: "Add a waterfall chart to a spreadsheet",
5
- inputSchema: {
6
- type: "object",
7
- properties: {
8
- spreadsheetId: {
9
- type: "string",
10
- description: "The ID of the spreadsheet",
11
- },
12
- sheetId: {
13
- type: "number",
14
- description: "The ID of the sheet where the chart will be placed",
15
- },
16
- title: {
17
- type: "string",
18
- description: "Chart title (optional)",
19
- },
20
- dataSheetId: {
21
- type: "number",
22
- description: "The sheet ID containing the data",
23
- },
24
- dataStartRow: {
25
- type: "number",
26
- description: "Starting row of data range (0-based)",
27
- },
28
- dataEndRow: {
29
- type: "number",
30
- description: "Ending row of data range (exclusive, 0-based)",
31
- },
32
- dataStartColumn: {
33
- type: "number",
34
- description: "Starting column of data range (0-based)",
35
- },
36
- dataEndColumn: {
37
- type: "number",
38
- description: "Ending column of data range (exclusive, 0-based)",
39
- },
40
- firstValueIsTotal: {
41
- type: "boolean",
42
- description: "Whether the first value should be treated as a total (optional)",
43
- },
44
- hideConnectorLines: {
45
- type: "boolean",
46
- description: "Whether to hide connector lines (optional)",
47
- },
48
- position: {
49
- type: "object",
50
- properties: {
51
- overlayRow: {
52
- type: "number",
53
- description: "Row position for chart overlay (0-based)",
54
- },
55
- overlayColumn: {
56
- type: "number",
57
- description: "Column position for chart overlay (0-based)",
58
- },
59
- },
60
- description: "Chart position (optional)",
61
- },
62
- },
63
- required: ["spreadsheetId", "sheetId", "dataSheetId", "dataStartRow", "dataEndRow", "dataStartColumn", "dataEndColumn"],
64
- },
65
- };
66
- export async function addWaterfall(args) {
67
- try {
68
- const sheets = google.sheets("v4");
69
- const waterfallChart = {
70
- series: [
71
- {
72
- sourceRange: {
73
- sources: [
74
- {
75
- sheetId: args.dataSheetId,
76
- startRowIndex: args.dataStartRow,
77
- endRowIndex: args.dataEndRow,
78
- startColumnIndex: args.dataStartColumn + 1,
79
- endColumnIndex: args.dataEndColumn,
80
- },
81
- ],
82
- },
83
- },
84
- ],
85
- domain: {
86
- sourceRange: {
87
- sources: [
88
- {
89
- sheetId: args.dataSheetId,
90
- startRowIndex: args.dataStartRow,
91
- endRowIndex: args.dataEndRow,
92
- startColumnIndex: args.dataStartColumn,
93
- endColumnIndex: args.dataStartColumn + 1,
94
- },
95
- ],
96
- },
97
- },
98
- };
99
- if (args.firstValueIsTotal !== undefined) {
100
- waterfallChart.firstValueIsTotal = args.firstValueIsTotal;
101
- }
102
- if (args.hideConnectorLines !== undefined) {
103
- waterfallChart.hideConnectorLines = args.hideConnectorLines;
104
- }
105
- const chartSpec = {
106
- title: args.title || "Waterfall Chart",
107
- waterfallChart,
108
- };
109
- const position = {
110
- overlayPosition: {
111
- anchorCell: {
112
- sheetId: args.sheetId,
113
- rowIndex: args.position?.overlayRow || 0,
114
- columnIndex: args.position?.overlayColumn || 0,
115
- },
116
- },
117
- };
118
- const response = await sheets.spreadsheets.batchUpdate({
119
- spreadsheetId: args.spreadsheetId,
120
- requestBody: {
121
- requests: [
122
- {
123
- addChart: {
124
- chart: {
125
- spec: chartSpec,
126
- position,
127
- },
128
- },
129
- },
130
- ],
131
- },
132
- });
133
- const chartId = response.data.replies?.[0]?.addChart?.chart?.chartId;
134
- return {
135
- content: [
136
- {
137
- type: "text",
138
- text: `Successfully created waterfall chart. Chart ID: ${chartId}`,
139
- },
140
- ],
141
- isError: false,
142
- };
143
- }
144
- catch (error) {
145
- return {
146
- content: [
147
- {
148
- type: "text",
149
- text: `Error creating waterfall chart: ${error.message}`,
150
- },
151
- ],
152
- isError: true,
153
- };
154
- }
155
- }
@@ -1,68 +0,0 @@
1
- import { google } from "googleapis";
2
- export const schema = {
3
- name: "gsheets_append_data",
4
- description: "Append data to the end of a sheet in a Google Spreadsheet",
5
- inputSchema: {
6
- type: "object",
7
- properties: {
8
- spreadsheetId: {
9
- type: "string",
10
- description: "The ID of the spreadsheet",
11
- },
12
- range: {
13
- type: "string",
14
- description: "The A1 notation range to append to (e.g., 'Sheet1!A:B')",
15
- },
16
- values: {
17
- type: "array",
18
- items: {
19
- type: "array",
20
- items: {
21
- type: "string",
22
- },
23
- },
24
- description: "2D array of values to append",
25
- },
26
- valueInputOption: {
27
- type: "string",
28
- enum: ["RAW", "USER_ENTERED"],
29
- description: "How input data should be interpreted (RAW or USER_ENTERED). Default: RAW",
30
- },
31
- },
32
- required: ["spreadsheetId", "range", "values"],
33
- },
34
- };
35
- export async function appendData(args) {
36
- try {
37
- const sheets = google.sheets("v4");
38
- const response = await sheets.spreadsheets.values.append({
39
- spreadsheetId: args.spreadsheetId,
40
- range: args.range,
41
- valueInputOption: args.valueInputOption || "RAW",
42
- requestBody: {
43
- values: args.values,
44
- },
45
- });
46
- const updates = response.data.updates;
47
- return {
48
- content: [
49
- {
50
- type: "text",
51
- text: `Successfully appended ${updates?.updatedRows || 0} row(s) and ${updates?.updatedColumns || 0} column(s) to range ${updates?.updatedRange}`,
52
- },
53
- ],
54
- isError: false,
55
- };
56
- }
57
- catch (error) {
58
- return {
59
- content: [
60
- {
61
- type: "text",
62
- text: `Error appending data: ${error.message}`,
63
- },
64
- ],
65
- isError: true,
66
- };
67
- }
68
- }
@@ -1,75 +0,0 @@
1
- import { google } from "googleapis";
2
- export const schema = {
3
- name: "gsheets_auto_resize",
4
- description: "Automatically resize rows or columns to fit content",
5
- inputSchema: {
6
- type: "object",
7
- properties: {
8
- spreadsheetId: {
9
- type: "string",
10
- description: "The ID of the spreadsheet",
11
- },
12
- sheetId: {
13
- type: "number",
14
- description: "The ID of the sheet",
15
- },
16
- dimension: {
17
- type: "string",
18
- enum: ["ROWS", "COLUMNS"],
19
- description: "Whether to resize rows or columns",
20
- },
21
- startIndex: {
22
- type: "number",
23
- description: "The starting index (0-based) of rows/columns to resize",
24
- },
25
- endIndex: {
26
- type: "number",
27
- description: "The ending index (exclusive, 0-based) of rows/columns to resize",
28
- },
29
- },
30
- required: ["spreadsheetId", "sheetId", "dimension", "startIndex", "endIndex"],
31
- },
32
- };
33
- export async function autoResize(args) {
34
- try {
35
- const sheets = google.sheets("v4");
36
- await sheets.spreadsheets.batchUpdate({
37
- spreadsheetId: args.spreadsheetId,
38
- requestBody: {
39
- requests: [
40
- {
41
- autoResizeDimensions: {
42
- dimensions: {
43
- sheetId: args.sheetId,
44
- dimension: args.dimension,
45
- startIndex: args.startIndex,
46
- endIndex: args.endIndex,
47
- },
48
- },
49
- },
50
- ],
51
- },
52
- });
53
- const count = args.endIndex - args.startIndex;
54
- return {
55
- content: [
56
- {
57
- type: "text",
58
- text: `Successfully auto-resized ${count} ${args.dimension.toLowerCase()} (indices ${args.startIndex}-${args.endIndex - 1})`,
59
- },
60
- ],
61
- isError: false,
62
- };
63
- }
64
- catch (error) {
65
- return {
66
- content: [
67
- {
68
- type: "text",
69
- text: `Error auto-resizing: ${error.message}`,
70
- },
71
- ],
72
- isError: true,
73
- };
74
- }
75
- }
@@ -1,53 +0,0 @@
1
- import { google } from "googleapis";
2
- export const schema = {
3
- name: "gsheets_batch_clear",
4
- description: "Clear data from multiple ranges in a Google Spreadsheet",
5
- inputSchema: {
6
- type: "object",
7
- properties: {
8
- spreadsheetId: {
9
- type: "string",
10
- description: "The ID of the spreadsheet",
11
- },
12
- ranges: {
13
- type: "array",
14
- items: {
15
- type: "string",
16
- },
17
- description: "Array of A1 notation ranges to clear (e.g., ['Sheet1!A1:B10', 'Sheet2!C5:D20'])",
18
- },
19
- },
20
- required: ["spreadsheetId", "ranges"],
21
- },
22
- };
23
- export async function batchClear(args) {
24
- try {
25
- const sheets = google.sheets("v4");
26
- const response = await sheets.spreadsheets.values.batchClear({
27
- spreadsheetId: args.spreadsheetId,
28
- requestBody: {
29
- ranges: args.ranges,
30
- },
31
- });
32
- return {
33
- content: [
34
- {
35
- type: "text",
36
- text: `Successfully cleared ${args.ranges.length} range(s): ${args.ranges.join(", ")}`,
37
- },
38
- ],
39
- isError: false,
40
- };
41
- }
42
- catch (error) {
43
- return {
44
- content: [
45
- {
46
- type: "text",
47
- text: `Error clearing ranges: ${error.message}`,
48
- },
49
- ],
50
- isError: true,
51
- };
52
- }
53
- }
@@ -1,81 +0,0 @@
1
- import { google } from "googleapis";
2
- export const schema = {
3
- name: "gsheets_batch_update",
4
- description: "Update multiple cell ranges in a Google Spreadsheet in a single batch operation",
5
- inputSchema: {
6
- type: "object",
7
- properties: {
8
- spreadsheetId: {
9
- type: "string",
10
- description: "The ID of the spreadsheet",
11
- },
12
- updates: {
13
- type: "array",
14
- items: {
15
- type: "object",
16
- properties: {
17
- range: {
18
- type: "string",
19
- description: "The A1 notation range (e.g., 'Sheet1!A1:B2')",
20
- },
21
- values: {
22
- type: "array",
23
- items: {
24
- type: "array",
25
- items: {
26
- type: "string",
27
- },
28
- },
29
- description: "2D array of values",
30
- },
31
- },
32
- required: ["range", "values"],
33
- },
34
- description: "Array of range-value pairs to update",
35
- },
36
- valueInputOption: {
37
- type: "string",
38
- enum: ["RAW", "USER_ENTERED"],
39
- description: "How input data should be interpreted (RAW or USER_ENTERED). Default: RAW",
40
- },
41
- },
42
- required: ["spreadsheetId", "updates"],
43
- },
44
- };
45
- export async function batchUpdate(args) {
46
- const sheets = google.sheets("v4");
47
- try {
48
- const response = await sheets.spreadsheets.values.batchUpdate({
49
- spreadsheetId: args.spreadsheetId,
50
- requestBody: {
51
- valueInputOption: args.valueInputOption || "RAW",
52
- data: args.updates.map((update) => ({
53
- range: update.range,
54
- values: update.values,
55
- })),
56
- },
57
- });
58
- const totalRows = response.data.totalUpdatedRows || 0;
59
- const totalCells = response.data.totalUpdatedCells || 0;
60
- return {
61
- content: [
62
- {
63
- type: "text",
64
- text: `Successfully updated ${args.updates.length} range(s): ${totalRows} row(s), ${totalCells} cell(s) modified`,
65
- },
66
- ],
67
- isError: false,
68
- };
69
- }
70
- catch (error) {
71
- return {
72
- content: [
73
- {
74
- type: "text",
75
- text: `Error batch updating: ${error.message}`,
76
- },
77
- ],
78
- isError: true,
79
- };
80
- }
81
- }
@@ -1,53 +0,0 @@
1
- import { google } from "googleapis";
2
- export const schema = {
3
- name: "gsheets_clear_data",
4
- description: "Clear data from specified ranges in a Google Spreadsheet",
5
- inputSchema: {
6
- type: "object",
7
- properties: {
8
- spreadsheetId: {
9
- type: "string",
10
- description: "The ID of the spreadsheet",
11
- },
12
- ranges: {
13
- type: "array",
14
- items: {
15
- type: "string",
16
- },
17
- description: "Array of A1 notation ranges to clear (e.g., ['Sheet1!A1:B10', 'Sheet2!C1:D5'])",
18
- },
19
- },
20
- required: ["spreadsheetId", "ranges"],
21
- },
22
- };
23
- export async function clearData(args) {
24
- const sheets = google.sheets("v4");
25
- try {
26
- const response = await sheets.spreadsheets.values.batchClear({
27
- spreadsheetId: args.spreadsheetId,
28
- requestBody: {
29
- ranges: args.ranges,
30
- },
31
- });
32
- return {
33
- content: [
34
- {
35
- type: "text",
36
- text: `Successfully cleared ${args.ranges.length} range(s): ${args.ranges.join(", ")}`,
37
- },
38
- ],
39
- isError: false,
40
- };
41
- }
42
- catch (error) {
43
- return {
44
- content: [
45
- {
46
- type: "text",
47
- text: `Error clearing data: ${error.message}`,
48
- },
49
- ],
50
- isError: true,
51
- };
52
- }
53
- }
@@ -1,56 +0,0 @@
1
- import { google } from "googleapis";
2
- export const schema = {
3
- name: "gsheets_copy_sheet",
4
- description: "Copy a sheet to another spreadsheet or within the same spreadsheet",
5
- inputSchema: {
6
- type: "object",
7
- properties: {
8
- sourceSpreadsheetId: {
9
- type: "string",
10
- description: "The ID of the source spreadsheet",
11
- },
12
- sourceSheetId: {
13
- type: "number",
14
- description: "The ID of the sheet to copy",
15
- },
16
- destinationSpreadsheetId: {
17
- type: "string",
18
- description: "The ID of the destination spreadsheet",
19
- },
20
- },
21
- required: ["sourceSpreadsheetId", "sourceSheetId", "destinationSpreadsheetId"],
22
- },
23
- };
24
- export async function copySheet(args) {
25
- const sheets = google.sheets("v4");
26
- try {
27
- const response = await sheets.spreadsheets.sheets.copyTo({
28
- spreadsheetId: args.sourceSpreadsheetId,
29
- sheetId: args.sourceSheetId,
30
- requestBody: {
31
- destinationSpreadsheetId: args.destinationSpreadsheetId,
32
- },
33
- });
34
- const copiedSheet = response.data;
35
- return {
36
- content: [
37
- {
38
- type: "text",
39
- text: `Successfully copied sheet to destination. New sheet ID: ${copiedSheet.sheetId}, Title: "${copiedSheet.title}"`,
40
- },
41
- ],
42
- isError: false,
43
- };
44
- }
45
- catch (error) {
46
- return {
47
- content: [
48
- {
49
- type: "text",
50
- text: `Error copying sheet: ${error.message}`,
51
- },
52
- ],
53
- isError: true,
54
- };
55
- }
56
- }
@@ -1,113 +0,0 @@
1
- import { google } from "googleapis";
2
- export const schema = {
3
- name: "gsheets_copy_to",
4
- description: "Copy data from one range to another range using cut/paste",
5
- inputSchema: {
6
- type: "object",
7
- properties: {
8
- spreadsheetId: {
9
- type: "string",
10
- description: "The ID of the spreadsheet",
11
- },
12
- sourceSheetId: {
13
- type: "number",
14
- description: "The ID of the source sheet",
15
- },
16
- sourceStartRow: {
17
- type: "number",
18
- description: "Source starting row index (0-based)",
19
- },
20
- sourceStartColumn: {
21
- type: "number",
22
- description: "Source starting column index (0-based)",
23
- },
24
- sourceEndRow: {
25
- type: "number",
26
- description: "Source ending row index (exclusive, 0-based)",
27
- },
28
- sourceEndColumn: {
29
- type: "number",
30
- description: "Source ending column index (exclusive, 0-based)",
31
- },
32
- destinationSheetId: {
33
- type: "number",
34
- description: "The ID of the destination sheet",
35
- },
36
- destinationStartRow: {
37
- type: "number",
38
- description: "Destination starting row index (0-based)",
39
- },
40
- destinationStartColumn: {
41
- type: "number",
42
- description: "Destination starting column index (0-based)",
43
- },
44
- pasteType: {
45
- type: "string",
46
- enum: ["NORMAL", "VALUES", "FORMAT", "FORMULA"],
47
- description: "What to paste (default: NORMAL - all data)",
48
- },
49
- },
50
- required: [
51
- "spreadsheetId",
52
- "sourceSheetId",
53
- "sourceStartRow",
54
- "sourceStartColumn",
55
- "sourceEndRow",
56
- "sourceEndColumn",
57
- "destinationSheetId",
58
- "destinationStartRow",
59
- "destinationStartColumn",
60
- ],
61
- },
62
- };
63
- export async function copyTo(args) {
64
- const sheets = google.sheets("v4");
65
- try {
66
- await sheets.spreadsheets.batchUpdate({
67
- spreadsheetId: args.spreadsheetId,
68
- requestBody: {
69
- requests: [
70
- {
71
- copyPaste: {
72
- source: {
73
- sheetId: args.sourceSheetId,
74
- startRowIndex: args.sourceStartRow,
75
- endRowIndex: args.sourceEndRow,
76
- startColumnIndex: args.sourceStartColumn,
77
- endColumnIndex: args.sourceEndColumn,
78
- },
79
- destination: {
80
- sheetId: args.destinationSheetId,
81
- startRowIndex: args.destinationStartRow,
82
- startColumnIndex: args.destinationStartColumn,
83
- },
84
- pasteType: args.pasteType || "NORMAL",
85
- },
86
- },
87
- ],
88
- },
89
- });
90
- const sourceRange = `R${args.sourceStartRow}C${args.sourceStartColumn}:R${args.sourceEndRow - 1}C${args.sourceEndColumn - 1}`;
91
- const destRange = `R${args.destinationStartRow}C${args.destinationStartColumn}`;
92
- return {
93
- content: [
94
- {
95
- type: "text",
96
- text: `Successfully copied data from sheet ${args.sourceSheetId} (${sourceRange}) to sheet ${args.destinationSheetId} (${destRange})`,
97
- },
98
- ],
99
- isError: false,
100
- };
101
- }
102
- catch (error) {
103
- return {
104
- content: [
105
- {
106
- type: "text",
107
- text: `Error copying data: ${error.message}`,
108
- },
109
- ],
110
- isError: true,
111
- };
112
- }
113
- }