@mcp-z/mcp-sheets 2.4.1 → 2.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 +45 -29
- package/dist/cjs/constants.d.cts +2 -0
- package/dist/cjs/constants.d.ts +2 -0
- package/dist/cjs/constants.js +27 -3
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/mcp/tools/cells-copy.d.cts +165 -0
- package/dist/cjs/mcp/tools/cells-copy.d.ts +165 -0
- package/dist/cjs/mcp/tools/cells-copy.js +388 -0
- package/dist/cjs/mcp/tools/cells-copy.js.map +1 -0
- package/dist/cjs/mcp/tools/csv-get-columns.js +107 -29
- package/dist/cjs/mcp/tools/csv-get-columns.js.map +1 -1
- package/dist/cjs/mcp/tools/index.d.cts +1 -0
- package/dist/cjs/mcp/tools/index.d.ts +1 -0
- package/dist/cjs/mcp/tools/index.js +4 -0
- package/dist/cjs/mcp/tools/index.js.map +1 -1
- package/dist/cjs/schemas/index.d.cts +1 -0
- package/dist/cjs/schemas/index.d.ts +1 -0
- package/dist/cjs/schemas/index.js +16 -0
- package/dist/cjs/schemas/index.js.map +1 -1
- package/dist/cjs/setup/config.js +26 -14
- package/dist/cjs/setup/config.js.map +1 -1
- package/dist/cjs/setup/version-help.js +1 -1
- package/dist/cjs/setup/version-help.js.map +1 -1
- package/dist/cjs/spreadsheet/data-operations.js +59 -164
- package/dist/cjs/spreadsheet/data-operations.js.map +1 -1
- package/dist/cjs/spreadsheet/range-operations.d.cts +26 -0
- package/dist/cjs/spreadsheet/range-operations.d.ts +26 -0
- package/dist/cjs/spreadsheet/range-operations.js +48 -0
- package/dist/cjs/spreadsheet/range-operations.js.map +1 -1
- package/dist/cjs/spreadsheet/sheet-operations.d.cts +6 -0
- package/dist/cjs/spreadsheet/sheet-operations.d.ts +6 -0
- package/dist/cjs/spreadsheet/sheet-operations.js +92 -52
- package/dist/cjs/spreadsheet/sheet-operations.js.map +1 -1
- package/dist/esm/constants.d.ts +2 -0
- package/dist/esm/constants.js +14 -0
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/mcp/tools/cells-copy.d.ts +165 -0
- package/dist/esm/mcp/tools/cells-copy.js +190 -0
- package/dist/esm/mcp/tools/cells-copy.js.map +1 -0
- package/dist/esm/mcp/tools/csv-get-columns.js +44 -6
- package/dist/esm/mcp/tools/csv-get-columns.js.map +1 -1
- package/dist/esm/mcp/tools/index.d.ts +1 -0
- package/dist/esm/mcp/tools/index.js +1 -0
- package/dist/esm/mcp/tools/index.js.map +1 -1
- package/dist/esm/schemas/index.d.ts +1 -0
- package/dist/esm/schemas/index.js +9 -0
- package/dist/esm/schemas/index.js.map +1 -1
- package/dist/esm/setup/config.js +26 -14
- package/dist/esm/setup/config.js.map +1 -1
- package/dist/esm/setup/version-help.js +7 -0
- package/dist/esm/setup/version-help.js.map +1 -1
- package/dist/esm/spreadsheet/data-operations.js +40 -84
- package/dist/esm/spreadsheet/data-operations.js.map +1 -1
- package/dist/esm/spreadsheet/range-operations.d.ts +26 -0
- package/dist/esm/spreadsheet/range-operations.js +50 -0
- package/dist/esm/spreadsheet/range-operations.js.map +1 -1
- package/dist/esm/spreadsheet/sheet-operations.d.ts +6 -0
- package/dist/esm/spreadsheet/sheet-operations.js +69 -43
- package/dist/esm/spreadsheet/sheet-operations.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -68,6 +68,18 @@ it sends no `initialize` handshake and carries no session id.
|
|
|
68
68
|
|
|
69
69
|
Configure via environment variables or the `env` block in `.mcp.json`. See `server.json` for the full list of options.
|
|
70
70
|
|
|
71
|
+
### Configuration file
|
|
72
|
+
|
|
73
|
+
Keep the client secret out of your shell and out of `.mcp.json` by putting it in a private file the server reads at startup, `~/.config/mcp-z/mcp-sheets/.env`:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
mkdir -p ~/.config/mcp-z/mcp-sheets && chmod 700 ~/.config/mcp-z/mcp-sheets
|
|
77
|
+
printf 'GOOGLE_CLIENT_ID=your-client-id\nGOOGLE_CLIENT_SECRET=your-client-secret\n' > ~/.config/mcp-z/mcp-sheets/.env
|
|
78
|
+
chmod 600 ~/.config/mcp-z/mcp-sheets/.env
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The server uses the first of `.mcp-z/mcp-sheets/.env` beside the nearest `.mcp.json` (else `~/.mcp-z/mcp-sheets/.env`) and `~/.config/mcp-z/mcp-sheets/.env` that exists. Anything set in the environment or in the `.mcp.json` `env` block overrides the file. On macOS and Linux the server refuses a file that other users can read.
|
|
82
|
+
|
|
71
83
|
### Loopback OAuth (default)
|
|
72
84
|
|
|
73
85
|
Environment variables:
|
|
@@ -172,39 +184,43 @@ npx -y @mcp-z/cli inspect --servers sheets --tools
|
|
|
172
184
|
|
|
173
185
|
# Find a spreadsheet
|
|
174
186
|
npx -y @mcp-z/cli call-tool sheets spreadsheet-find '{"spreadsheetRef":"Quarterly Report"}'
|
|
187
|
+
|
|
188
|
+
# Copy A1:C10 to E1 on another tab of the same spreadsheet (values only)
|
|
189
|
+
npx -y @mcp-z/cli call-tool sheets cells-copy '{"id":"SPREADSHEET_ID","sourceGid":0,"sourceRange":"A1:C10","destinationGid":123456,"destinationRange":"E1","pasteType":"PASTE_VALUES"}'
|
|
175
190
|
```
|
|
176
191
|
|
|
177
192
|
## Tools
|
|
178
193
|
|
|
179
|
-
1. cells-
|
|
180
|
-
2. cells-
|
|
181
|
-
3.
|
|
182
|
-
4.
|
|
183
|
-
5. columns-
|
|
184
|
-
6.
|
|
185
|
-
7.
|
|
186
|
-
8. dimensions-
|
|
187
|
-
9.
|
|
188
|
-
10. rows-
|
|
189
|
-
11. rows-
|
|
190
|
-
12.
|
|
191
|
-
13. sheet-copy
|
|
192
|
-
14. sheet-
|
|
193
|
-
15. sheet-
|
|
194
|
-
16. sheet-
|
|
195
|
-
17. sheet-
|
|
196
|
-
18.
|
|
197
|
-
19. spreadsheet-
|
|
198
|
-
20. spreadsheet-
|
|
199
|
-
21. spreadsheet-
|
|
200
|
-
22. spreadsheet-
|
|
201
|
-
23.
|
|
202
|
-
24.
|
|
203
|
-
25. values-
|
|
204
|
-
26. values-
|
|
205
|
-
27. values-
|
|
206
|
-
28. values-
|
|
207
|
-
29. values-
|
|
194
|
+
1. cells-copy
|
|
195
|
+
2. cells-format
|
|
196
|
+
3. cells-metadata-get
|
|
197
|
+
4. chart-create
|
|
198
|
+
5. columns-get
|
|
199
|
+
6. columns-update
|
|
200
|
+
7. csv-get-columns
|
|
201
|
+
8. dimensions-batch-update
|
|
202
|
+
9. dimensions-move
|
|
203
|
+
10. rows-append
|
|
204
|
+
11. rows-csv-append
|
|
205
|
+
12. rows-get
|
|
206
|
+
13. sheet-copy
|
|
207
|
+
14. sheet-copy-to
|
|
208
|
+
15. sheet-create
|
|
209
|
+
16. sheet-delete
|
|
210
|
+
17. sheet-find
|
|
211
|
+
18. sheet-rename
|
|
212
|
+
19. spreadsheet-copy
|
|
213
|
+
20. spreadsheet-create
|
|
214
|
+
21. spreadsheet-find
|
|
215
|
+
22. spreadsheet-metadata-get
|
|
216
|
+
23. spreadsheet-rename
|
|
217
|
+
24. validation-set
|
|
218
|
+
25. values-batch-update
|
|
219
|
+
26. values-clear
|
|
220
|
+
27. values-csv-update
|
|
221
|
+
28. values-markdown-update
|
|
222
|
+
29. values-replace
|
|
223
|
+
30. values-search
|
|
208
224
|
|
|
209
225
|
See [metadata usage](https://github.com/mcp-z/mcp-sheets/blob/master/usage/metadata.md) for workbook inspection and bounded cell reads.
|
|
210
226
|
|
package/dist/cjs/constants.d.cts
CHANGED
|
@@ -5,3 +5,5 @@
|
|
|
5
5
|
* rather than externally configured since this server knows its own requirements.
|
|
6
6
|
*/
|
|
7
7
|
export declare const GOOGLE_SCOPE = "openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/drive";
|
|
8
|
+
export declare const PASTE_TYPES: readonly ["PASTE_NORMAL", "PASTE_VALUES", "PASTE_FORMAT", "PASTE_NO_BORDERS", "PASTE_FORMULA", "PASTE_DATA_VALIDATION", "PASTE_CONDITIONAL_FORMATTING"];
|
|
9
|
+
export declare const PASTE_ORIENTATIONS: readonly ["NORMAL", "TRANSPOSE"];
|
package/dist/cjs/constants.d.ts
CHANGED
|
@@ -5,3 +5,5 @@
|
|
|
5
5
|
* rather than externally configured since this server knows its own requirements.
|
|
6
6
|
*/
|
|
7
7
|
export declare const GOOGLE_SCOPE = "openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/drive";
|
|
8
|
+
export declare const PASTE_TYPES: readonly ["PASTE_NORMAL", "PASTE_VALUES", "PASTE_FORMAT", "PASTE_NO_BORDERS", "PASTE_FORMULA", "PASTE_DATA_VALIDATION", "PASTE_CONDITIONAL_FORMATTING"];
|
|
9
|
+
export declare const PASTE_ORIENTATIONS: readonly ["NORMAL", "TRANSPOSE"];
|
package/dist/cjs/constants.js
CHANGED
|
@@ -8,11 +8,35 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", {
|
|
9
9
|
value: true
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
function _export(target, all) {
|
|
12
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
_export(exports, {
|
|
18
|
+
get GOOGLE_SCOPE () {
|
|
14
19
|
return GOOGLE_SCOPE;
|
|
20
|
+
},
|
|
21
|
+
get PASTE_ORIENTATIONS () {
|
|
22
|
+
return PASTE_ORIENTATIONS;
|
|
23
|
+
},
|
|
24
|
+
get PASTE_TYPES () {
|
|
25
|
+
return PASTE_TYPES;
|
|
15
26
|
}
|
|
16
27
|
});
|
|
17
28
|
var GOOGLE_SCOPE = 'openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/drive';
|
|
29
|
+
var PASTE_TYPES = [
|
|
30
|
+
'PASTE_NORMAL',
|
|
31
|
+
'PASTE_VALUES',
|
|
32
|
+
'PASTE_FORMAT',
|
|
33
|
+
'PASTE_NO_BORDERS',
|
|
34
|
+
'PASTE_FORMULA',
|
|
35
|
+
'PASTE_DATA_VALIDATION',
|
|
36
|
+
'PASTE_CONDITIONAL_FORMATTING'
|
|
37
|
+
];
|
|
38
|
+
var PASTE_ORIENTATIONS = [
|
|
39
|
+
'NORMAL',
|
|
40
|
+
'TRANSPOSE'
|
|
41
|
+
];
|
|
18
42
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/constants.ts"],"sourcesContent":["/**\n * Sheets MCP Server Constants\n *\n * These scopes are required for Google Sheets and Drive functionality and are hardcoded\n * rather than externally configured since this server knows its own requirements.\n */\n\n// Google OAuth scopes required for Sheets and Drive operations\nexport const GOOGLE_SCOPE = 'openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/drive';\n"],"names":["GOOGLE_SCOPE"],"mappings":"AAAA;;;;;CAKC,GAED,+DAA+D
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/constants.ts"],"sourcesContent":["/**\n * Sheets MCP Server Constants\n *\n * These scopes are required for Google Sheets and Drive functionality and are hardcoded\n * rather than externally configured since this server knows its own requirements.\n */\n\n// Google OAuth scopes required for Sheets and Drive operations\nexport const GOOGLE_SCOPE = 'openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/drive';\n\n// Native paste-special modes of the Sheets API CopyPasteRequest (PasteType / PasteOrientation)\nexport const PASTE_TYPES = ['PASTE_NORMAL', 'PASTE_VALUES', 'PASTE_FORMAT', 'PASTE_NO_BORDERS', 'PASTE_FORMULA', 'PASTE_DATA_VALIDATION', 'PASTE_CONDITIONAL_FORMATTING'] as const;\nexport const PASTE_ORIENTATIONS = ['NORMAL', 'TRANSPOSE'] as const;\n"],"names":["GOOGLE_SCOPE","PASTE_ORIENTATIONS","PASTE_TYPES"],"mappings":"AAAA;;;;;CAKC,GAED,+DAA+D;;;;;;;;;;;;QAClDA;eAAAA;;QAIAC;eAAAA;;QADAC;eAAAA;;;AAHN,IAAMF,eAAe;AAGrB,IAAME,cAAc;IAAC;IAAgB;IAAgB;IAAgB;IAAoB;IAAiB;IAAyB;CAA+B;AAClK,IAAMD,qBAAqB;IAAC;IAAU;CAAY"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { sheets_v4 } from '@googleapis/sheets';
|
|
2
|
+
import type { EnrichedExtra } from '@mcp-z/oauth-google';
|
|
3
|
+
import type { CallToolResult } from '@mcp-z/server';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
declare const inputSchema: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
sourceGid: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<string, string | number>>;
|
|
8
|
+
sourceRange: z.ZodString;
|
|
9
|
+
destinationGid: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<string, string | number>>;
|
|
10
|
+
destinationRange: z.ZodString;
|
|
11
|
+
pasteType: z.ZodDefault<z.ZodEnum<{
|
|
12
|
+
PASTE_NORMAL: "PASTE_NORMAL";
|
|
13
|
+
PASTE_VALUES: "PASTE_VALUES";
|
|
14
|
+
PASTE_FORMAT: "PASTE_FORMAT";
|
|
15
|
+
PASTE_NO_BORDERS: "PASTE_NO_BORDERS";
|
|
16
|
+
PASTE_FORMULA: "PASTE_FORMULA";
|
|
17
|
+
PASTE_DATA_VALIDATION: "PASTE_DATA_VALIDATION";
|
|
18
|
+
PASTE_CONDITIONAL_FORMATTING: "PASTE_CONDITIONAL_FORMATTING";
|
|
19
|
+
}>>;
|
|
20
|
+
pasteOrientation: z.ZodDefault<z.ZodEnum<{
|
|
21
|
+
NORMAL: "NORMAL";
|
|
22
|
+
TRANSPOSE: "TRANSPOSE";
|
|
23
|
+
}>>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
declare const successBranchSchema: z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<"success">;
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
spreadsheetTitle: z.ZodString;
|
|
29
|
+
spreadsheetUrl: z.ZodString;
|
|
30
|
+
sourceGid: z.ZodString;
|
|
31
|
+
sourceSheetTitle: z.ZodString;
|
|
32
|
+
sourceRange: z.ZodString;
|
|
33
|
+
destinationGid: z.ZodString;
|
|
34
|
+
destinationSheetTitle: z.ZodString;
|
|
35
|
+
destinationRange: z.ZodString;
|
|
36
|
+
pastedRange: z.ZodString;
|
|
37
|
+
pasteType: z.ZodEnum<{
|
|
38
|
+
PASTE_NORMAL: "PASTE_NORMAL";
|
|
39
|
+
PASTE_VALUES: "PASTE_VALUES";
|
|
40
|
+
PASTE_FORMAT: "PASTE_FORMAT";
|
|
41
|
+
PASTE_NO_BORDERS: "PASTE_NO_BORDERS";
|
|
42
|
+
PASTE_FORMULA: "PASTE_FORMULA";
|
|
43
|
+
PASTE_DATA_VALIDATION: "PASTE_DATA_VALIDATION";
|
|
44
|
+
PASTE_CONDITIONAL_FORMATTING: "PASTE_CONDITIONAL_FORMATTING";
|
|
45
|
+
}>;
|
|
46
|
+
pasteOrientation: z.ZodEnum<{
|
|
47
|
+
NORMAL: "NORMAL";
|
|
48
|
+
TRANSPOSE: "TRANSPOSE";
|
|
49
|
+
}>;
|
|
50
|
+
sheetUrl: z.ZodString;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53
|
+
type: z.ZodLiteral<"success">;
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
spreadsheetTitle: z.ZodString;
|
|
56
|
+
spreadsheetUrl: z.ZodString;
|
|
57
|
+
sourceGid: z.ZodString;
|
|
58
|
+
sourceSheetTitle: z.ZodString;
|
|
59
|
+
sourceRange: z.ZodString;
|
|
60
|
+
destinationGid: z.ZodString;
|
|
61
|
+
destinationSheetTitle: z.ZodString;
|
|
62
|
+
destinationRange: z.ZodString;
|
|
63
|
+
pastedRange: z.ZodString;
|
|
64
|
+
pasteType: z.ZodEnum<{
|
|
65
|
+
PASTE_NORMAL: "PASTE_NORMAL";
|
|
66
|
+
PASTE_VALUES: "PASTE_VALUES";
|
|
67
|
+
PASTE_FORMAT: "PASTE_FORMAT";
|
|
68
|
+
PASTE_NO_BORDERS: "PASTE_NO_BORDERS";
|
|
69
|
+
PASTE_FORMULA: "PASTE_FORMULA";
|
|
70
|
+
PASTE_DATA_VALIDATION: "PASTE_DATA_VALIDATION";
|
|
71
|
+
PASTE_CONDITIONAL_FORMATTING: "PASTE_CONDITIONAL_FORMATTING";
|
|
72
|
+
}>;
|
|
73
|
+
pasteOrientation: z.ZodEnum<{
|
|
74
|
+
NORMAL: "NORMAL";
|
|
75
|
+
TRANSPOSE: "TRANSPOSE";
|
|
76
|
+
}>;
|
|
77
|
+
sheetUrl: z.ZodString;
|
|
78
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"auth_required">;
|
|
80
|
+
provider: z.ZodString;
|
|
81
|
+
message: z.ZodString;
|
|
82
|
+
url: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, z.core.$strip>], "type">;
|
|
84
|
+
export type Input = z.infer<typeof inputSchema>;
|
|
85
|
+
export type Output = z.infer<typeof outputSchema>;
|
|
86
|
+
type SuccessOutput = z.infer<typeof successBranchSchema>;
|
|
87
|
+
/** The slice of the Sheets client this tool uses; tests pass a plain fake. */
|
|
88
|
+
export interface CellsCopySheets {
|
|
89
|
+
spreadsheets: {
|
|
90
|
+
get(params: {
|
|
91
|
+
spreadsheetId: string;
|
|
92
|
+
fields: string;
|
|
93
|
+
}): Promise<{
|
|
94
|
+
data: sheets_v4.Schema$Spreadsheet;
|
|
95
|
+
}>;
|
|
96
|
+
batchUpdate(params: {
|
|
97
|
+
spreadsheetId: string;
|
|
98
|
+
requestBody: sheets_v4.Schema$BatchUpdateSpreadsheetRequest;
|
|
99
|
+
}): Promise<unknown>;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export declare function copyCells(sheets: CellsCopySheets, { id, sourceGid, sourceRange, destinationGid, destinationRange, pasteType, pasteOrientation }: Input): Promise<SuccessOutput>;
|
|
103
|
+
declare function handler(input: Input, extra: EnrichedExtra): Promise<CallToolResult>;
|
|
104
|
+
export default function createTool(): {
|
|
105
|
+
name: string;
|
|
106
|
+
config: {
|
|
107
|
+
readonly description: "Copy a cell range to another range in the same spreadsheet (same or different tab), like Google Sheets copy and paste-special. Default PASTE_NORMAL copies values, formulas (relative references adjust), formats and merges; pasteType selects one native paste-special mode. Cannot copy between spreadsheets: use sheet-copy-to first. To duplicate a whole tab or workbook use sheet-copy, sheet-copy-to or spreadsheet-copy. Use a1-notation prompt for range syntax.";
|
|
108
|
+
readonly inputSchema: z.ZodObject<{
|
|
109
|
+
id: z.ZodString;
|
|
110
|
+
sourceGid: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<string, string | number>>;
|
|
111
|
+
sourceRange: z.ZodString;
|
|
112
|
+
destinationGid: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<string, string | number>>;
|
|
113
|
+
destinationRange: z.ZodString;
|
|
114
|
+
pasteType: z.ZodDefault<z.ZodEnum<{
|
|
115
|
+
PASTE_NORMAL: "PASTE_NORMAL";
|
|
116
|
+
PASTE_VALUES: "PASTE_VALUES";
|
|
117
|
+
PASTE_FORMAT: "PASTE_FORMAT";
|
|
118
|
+
PASTE_NO_BORDERS: "PASTE_NO_BORDERS";
|
|
119
|
+
PASTE_FORMULA: "PASTE_FORMULA";
|
|
120
|
+
PASTE_DATA_VALIDATION: "PASTE_DATA_VALIDATION";
|
|
121
|
+
PASTE_CONDITIONAL_FORMATTING: "PASTE_CONDITIONAL_FORMATTING";
|
|
122
|
+
}>>;
|
|
123
|
+
pasteOrientation: z.ZodDefault<z.ZodEnum<{
|
|
124
|
+
NORMAL: "NORMAL";
|
|
125
|
+
TRANSPOSE: "TRANSPOSE";
|
|
126
|
+
}>>;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
readonly outputSchema: z.ZodObject<{
|
|
129
|
+
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
130
|
+
type: z.ZodLiteral<"success">;
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
spreadsheetTitle: z.ZodString;
|
|
133
|
+
spreadsheetUrl: z.ZodString;
|
|
134
|
+
sourceGid: z.ZodString;
|
|
135
|
+
sourceSheetTitle: z.ZodString;
|
|
136
|
+
sourceRange: z.ZodString;
|
|
137
|
+
destinationGid: z.ZodString;
|
|
138
|
+
destinationSheetTitle: z.ZodString;
|
|
139
|
+
destinationRange: z.ZodString;
|
|
140
|
+
pastedRange: z.ZodString;
|
|
141
|
+
pasteType: z.ZodEnum<{
|
|
142
|
+
PASTE_NORMAL: "PASTE_NORMAL";
|
|
143
|
+
PASTE_VALUES: "PASTE_VALUES";
|
|
144
|
+
PASTE_FORMAT: "PASTE_FORMAT";
|
|
145
|
+
PASTE_NO_BORDERS: "PASTE_NO_BORDERS";
|
|
146
|
+
PASTE_FORMULA: "PASTE_FORMULA";
|
|
147
|
+
PASTE_DATA_VALIDATION: "PASTE_DATA_VALIDATION";
|
|
148
|
+
PASTE_CONDITIONAL_FORMATTING: "PASTE_CONDITIONAL_FORMATTING";
|
|
149
|
+
}>;
|
|
150
|
+
pasteOrientation: z.ZodEnum<{
|
|
151
|
+
NORMAL: "NORMAL";
|
|
152
|
+
TRANSPOSE: "TRANSPOSE";
|
|
153
|
+
}>;
|
|
154
|
+
sheetUrl: z.ZodString;
|
|
155
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
156
|
+
type: z.ZodLiteral<"auth_required">;
|
|
157
|
+
provider: z.ZodString;
|
|
158
|
+
message: z.ZodString;
|
|
159
|
+
url: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, z.core.$strip>], "type">;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
};
|
|
163
|
+
handler: typeof handler;
|
|
164
|
+
};
|
|
165
|
+
export {};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { sheets_v4 } from '@googleapis/sheets';
|
|
2
|
+
import type { EnrichedExtra } from '@mcp-z/oauth-google';
|
|
3
|
+
import type { CallToolResult } from '@mcp-z/server';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
declare const inputSchema: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
sourceGid: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<string, string | number>>;
|
|
8
|
+
sourceRange: z.ZodString;
|
|
9
|
+
destinationGid: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<string, string | number>>;
|
|
10
|
+
destinationRange: z.ZodString;
|
|
11
|
+
pasteType: z.ZodDefault<z.ZodEnum<{
|
|
12
|
+
PASTE_NORMAL: "PASTE_NORMAL";
|
|
13
|
+
PASTE_VALUES: "PASTE_VALUES";
|
|
14
|
+
PASTE_FORMAT: "PASTE_FORMAT";
|
|
15
|
+
PASTE_NO_BORDERS: "PASTE_NO_BORDERS";
|
|
16
|
+
PASTE_FORMULA: "PASTE_FORMULA";
|
|
17
|
+
PASTE_DATA_VALIDATION: "PASTE_DATA_VALIDATION";
|
|
18
|
+
PASTE_CONDITIONAL_FORMATTING: "PASTE_CONDITIONAL_FORMATTING";
|
|
19
|
+
}>>;
|
|
20
|
+
pasteOrientation: z.ZodDefault<z.ZodEnum<{
|
|
21
|
+
NORMAL: "NORMAL";
|
|
22
|
+
TRANSPOSE: "TRANSPOSE";
|
|
23
|
+
}>>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
declare const successBranchSchema: z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<"success">;
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
spreadsheetTitle: z.ZodString;
|
|
29
|
+
spreadsheetUrl: z.ZodString;
|
|
30
|
+
sourceGid: z.ZodString;
|
|
31
|
+
sourceSheetTitle: z.ZodString;
|
|
32
|
+
sourceRange: z.ZodString;
|
|
33
|
+
destinationGid: z.ZodString;
|
|
34
|
+
destinationSheetTitle: z.ZodString;
|
|
35
|
+
destinationRange: z.ZodString;
|
|
36
|
+
pastedRange: z.ZodString;
|
|
37
|
+
pasteType: z.ZodEnum<{
|
|
38
|
+
PASTE_NORMAL: "PASTE_NORMAL";
|
|
39
|
+
PASTE_VALUES: "PASTE_VALUES";
|
|
40
|
+
PASTE_FORMAT: "PASTE_FORMAT";
|
|
41
|
+
PASTE_NO_BORDERS: "PASTE_NO_BORDERS";
|
|
42
|
+
PASTE_FORMULA: "PASTE_FORMULA";
|
|
43
|
+
PASTE_DATA_VALIDATION: "PASTE_DATA_VALIDATION";
|
|
44
|
+
PASTE_CONDITIONAL_FORMATTING: "PASTE_CONDITIONAL_FORMATTING";
|
|
45
|
+
}>;
|
|
46
|
+
pasteOrientation: z.ZodEnum<{
|
|
47
|
+
NORMAL: "NORMAL";
|
|
48
|
+
TRANSPOSE: "TRANSPOSE";
|
|
49
|
+
}>;
|
|
50
|
+
sheetUrl: z.ZodString;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53
|
+
type: z.ZodLiteral<"success">;
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
spreadsheetTitle: z.ZodString;
|
|
56
|
+
spreadsheetUrl: z.ZodString;
|
|
57
|
+
sourceGid: z.ZodString;
|
|
58
|
+
sourceSheetTitle: z.ZodString;
|
|
59
|
+
sourceRange: z.ZodString;
|
|
60
|
+
destinationGid: z.ZodString;
|
|
61
|
+
destinationSheetTitle: z.ZodString;
|
|
62
|
+
destinationRange: z.ZodString;
|
|
63
|
+
pastedRange: z.ZodString;
|
|
64
|
+
pasteType: z.ZodEnum<{
|
|
65
|
+
PASTE_NORMAL: "PASTE_NORMAL";
|
|
66
|
+
PASTE_VALUES: "PASTE_VALUES";
|
|
67
|
+
PASTE_FORMAT: "PASTE_FORMAT";
|
|
68
|
+
PASTE_NO_BORDERS: "PASTE_NO_BORDERS";
|
|
69
|
+
PASTE_FORMULA: "PASTE_FORMULA";
|
|
70
|
+
PASTE_DATA_VALIDATION: "PASTE_DATA_VALIDATION";
|
|
71
|
+
PASTE_CONDITIONAL_FORMATTING: "PASTE_CONDITIONAL_FORMATTING";
|
|
72
|
+
}>;
|
|
73
|
+
pasteOrientation: z.ZodEnum<{
|
|
74
|
+
NORMAL: "NORMAL";
|
|
75
|
+
TRANSPOSE: "TRANSPOSE";
|
|
76
|
+
}>;
|
|
77
|
+
sheetUrl: z.ZodString;
|
|
78
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"auth_required">;
|
|
80
|
+
provider: z.ZodString;
|
|
81
|
+
message: z.ZodString;
|
|
82
|
+
url: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, z.core.$strip>], "type">;
|
|
84
|
+
export type Input = z.infer<typeof inputSchema>;
|
|
85
|
+
export type Output = z.infer<typeof outputSchema>;
|
|
86
|
+
type SuccessOutput = z.infer<typeof successBranchSchema>;
|
|
87
|
+
/** The slice of the Sheets client this tool uses; tests pass a plain fake. */
|
|
88
|
+
export interface CellsCopySheets {
|
|
89
|
+
spreadsheets: {
|
|
90
|
+
get(params: {
|
|
91
|
+
spreadsheetId: string;
|
|
92
|
+
fields: string;
|
|
93
|
+
}): Promise<{
|
|
94
|
+
data: sheets_v4.Schema$Spreadsheet;
|
|
95
|
+
}>;
|
|
96
|
+
batchUpdate(params: {
|
|
97
|
+
spreadsheetId: string;
|
|
98
|
+
requestBody: sheets_v4.Schema$BatchUpdateSpreadsheetRequest;
|
|
99
|
+
}): Promise<unknown>;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export declare function copyCells(sheets: CellsCopySheets, { id, sourceGid, sourceRange, destinationGid, destinationRange, pasteType, pasteOrientation }: Input): Promise<SuccessOutput>;
|
|
103
|
+
declare function handler(input: Input, extra: EnrichedExtra): Promise<CallToolResult>;
|
|
104
|
+
export default function createTool(): {
|
|
105
|
+
name: string;
|
|
106
|
+
config: {
|
|
107
|
+
readonly description: "Copy a cell range to another range in the same spreadsheet (same or different tab), like Google Sheets copy and paste-special. Default PASTE_NORMAL copies values, formulas (relative references adjust), formats and merges; pasteType selects one native paste-special mode. Cannot copy between spreadsheets: use sheet-copy-to first. To duplicate a whole tab or workbook use sheet-copy, sheet-copy-to or spreadsheet-copy. Use a1-notation prompt for range syntax.";
|
|
108
|
+
readonly inputSchema: z.ZodObject<{
|
|
109
|
+
id: z.ZodString;
|
|
110
|
+
sourceGid: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<string, string | number>>;
|
|
111
|
+
sourceRange: z.ZodString;
|
|
112
|
+
destinationGid: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<string, string | number>>;
|
|
113
|
+
destinationRange: z.ZodString;
|
|
114
|
+
pasteType: z.ZodDefault<z.ZodEnum<{
|
|
115
|
+
PASTE_NORMAL: "PASTE_NORMAL";
|
|
116
|
+
PASTE_VALUES: "PASTE_VALUES";
|
|
117
|
+
PASTE_FORMAT: "PASTE_FORMAT";
|
|
118
|
+
PASTE_NO_BORDERS: "PASTE_NO_BORDERS";
|
|
119
|
+
PASTE_FORMULA: "PASTE_FORMULA";
|
|
120
|
+
PASTE_DATA_VALIDATION: "PASTE_DATA_VALIDATION";
|
|
121
|
+
PASTE_CONDITIONAL_FORMATTING: "PASTE_CONDITIONAL_FORMATTING";
|
|
122
|
+
}>>;
|
|
123
|
+
pasteOrientation: z.ZodDefault<z.ZodEnum<{
|
|
124
|
+
NORMAL: "NORMAL";
|
|
125
|
+
TRANSPOSE: "TRANSPOSE";
|
|
126
|
+
}>>;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
readonly outputSchema: z.ZodObject<{
|
|
129
|
+
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
130
|
+
type: z.ZodLiteral<"success">;
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
spreadsheetTitle: z.ZodString;
|
|
133
|
+
spreadsheetUrl: z.ZodString;
|
|
134
|
+
sourceGid: z.ZodString;
|
|
135
|
+
sourceSheetTitle: z.ZodString;
|
|
136
|
+
sourceRange: z.ZodString;
|
|
137
|
+
destinationGid: z.ZodString;
|
|
138
|
+
destinationSheetTitle: z.ZodString;
|
|
139
|
+
destinationRange: z.ZodString;
|
|
140
|
+
pastedRange: z.ZodString;
|
|
141
|
+
pasteType: z.ZodEnum<{
|
|
142
|
+
PASTE_NORMAL: "PASTE_NORMAL";
|
|
143
|
+
PASTE_VALUES: "PASTE_VALUES";
|
|
144
|
+
PASTE_FORMAT: "PASTE_FORMAT";
|
|
145
|
+
PASTE_NO_BORDERS: "PASTE_NO_BORDERS";
|
|
146
|
+
PASTE_FORMULA: "PASTE_FORMULA";
|
|
147
|
+
PASTE_DATA_VALIDATION: "PASTE_DATA_VALIDATION";
|
|
148
|
+
PASTE_CONDITIONAL_FORMATTING: "PASTE_CONDITIONAL_FORMATTING";
|
|
149
|
+
}>;
|
|
150
|
+
pasteOrientation: z.ZodEnum<{
|
|
151
|
+
NORMAL: "NORMAL";
|
|
152
|
+
TRANSPOSE: "TRANSPOSE";
|
|
153
|
+
}>;
|
|
154
|
+
sheetUrl: z.ZodString;
|
|
155
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
156
|
+
type: z.ZodLiteral<"auth_required">;
|
|
157
|
+
provider: z.ZodString;
|
|
158
|
+
message: z.ZodString;
|
|
159
|
+
url: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, z.core.$strip>], "type">;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
};
|
|
163
|
+
handler: typeof handler;
|
|
164
|
+
};
|
|
165
|
+
export {};
|