@mcp-z/mcp-sheets 2.3.2 → 2.4.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 +32 -27
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/create-store.js.map +1 -1
- package/dist/cjs/lib/google-auth.js.map +1 -1
- package/dist/cjs/mcp/index.js.map +1 -1
- package/dist/cjs/mcp/prompts/a1-notation.js.map +1 -1
- package/dist/cjs/mcp/prompts/index.js.map +1 -1
- package/dist/cjs/mcp/resources/index.js.map +1 -1
- package/dist/cjs/mcp/resources/spreadsheet.js.map +1 -1
- package/dist/cjs/mcp/tools/cells-format.js.map +1 -1
- package/dist/cjs/mcp/tools/cells-metadata-get.d.cts +95 -0
- package/dist/cjs/mcp/tools/cells-metadata-get.d.ts +95 -0
- package/dist/cjs/mcp/tools/cells-metadata-get.js +331 -0
- package/dist/cjs/mcp/tools/cells-metadata-get.js.map +1 -0
- package/dist/cjs/mcp/tools/chart-create.js.map +1 -1
- package/dist/cjs/mcp/tools/columns-get.js.map +1 -1
- package/dist/cjs/mcp/tools/columns-update.js.map +1 -1
- package/dist/cjs/mcp/tools/csv-get-columns.js.map +1 -1
- package/dist/cjs/mcp/tools/dimensions-batch-update.js.map +1 -1
- package/dist/cjs/mcp/tools/dimensions-move.js.map +1 -1
- package/dist/cjs/mcp/tools/index.d.cts +2 -0
- package/dist/cjs/mcp/tools/index.d.ts +2 -0
- package/dist/cjs/mcp/tools/index.js +8 -0
- package/dist/cjs/mcp/tools/index.js.map +1 -1
- package/dist/cjs/mcp/tools/lib/dimension-operations.js.map +1 -1
- package/dist/cjs/mcp/tools/rows-append.js.map +1 -1
- package/dist/cjs/mcp/tools/rows-csv-append.js.map +1 -1
- package/dist/cjs/mcp/tools/rows-get.js.map +1 -1
- package/dist/cjs/mcp/tools/sheet-copy-to.js.map +1 -1
- package/dist/cjs/mcp/tools/sheet-copy.js.map +1 -1
- package/dist/cjs/mcp/tools/sheet-create.js.map +1 -1
- package/dist/cjs/mcp/tools/sheet-delete.js.map +1 -1
- package/dist/cjs/mcp/tools/sheet-find.js.map +1 -1
- package/dist/cjs/mcp/tools/sheet-rename.js.map +1 -1
- package/dist/cjs/mcp/tools/spreadsheet-copy.js.map +1 -1
- package/dist/cjs/mcp/tools/spreadsheet-create.js.map +1 -1
- package/dist/cjs/mcp/tools/spreadsheet-find.js.map +1 -1
- package/dist/cjs/mcp/tools/spreadsheet-metadata-get.d.cts +59 -0
- package/dist/cjs/mcp/tools/spreadsheet-metadata-get.d.ts +59 -0
- package/dist/cjs/mcp/tools/spreadsheet-metadata-get.js +259 -0
- package/dist/cjs/mcp/tools/spreadsheet-metadata-get.js.map +1 -0
- package/dist/cjs/mcp/tools/spreadsheet-rename.js.map +1 -1
- package/dist/cjs/mcp/tools/validation-set.js.map +1 -1
- package/dist/cjs/mcp/tools/values-batch-update.js.map +1 -1
- package/dist/cjs/mcp/tools/values-clear.js.map +1 -1
- package/dist/cjs/mcp/tools/values-csv-update.js.map +1 -1
- package/dist/cjs/mcp/tools/values-markdown-update.js.map +1 -1
- package/dist/cjs/mcp/tools/values-replace.js.map +1 -1
- package/dist/cjs/mcp/tools/values-search.js.map +1 -1
- package/dist/cjs/schemas/index.js.map +1 -1
- package/dist/cjs/setup/config.js.map +1 -1
- package/dist/cjs/setup/http.d.cts +1 -1
- package/dist/cjs/setup/http.d.ts +1 -1
- package/dist/cjs/setup/http.js.map +1 -1
- package/dist/cjs/setup/index.js.map +1 -1
- package/dist/cjs/setup/oauth-google.js.map +1 -1
- package/dist/cjs/setup/runtime.js.map +1 -1
- package/dist/cjs/setup/stdio.js.map +1 -1
- package/dist/cjs/setup/version-help.js.map +1 -1
- package/dist/cjs/spreadsheet/column-utilities.js.map +1 -1
- package/dist/cjs/spreadsheet/csv-streaming.js.map +1 -1
- package/dist/cjs/spreadsheet/data-operations.js.map +1 -1
- package/dist/cjs/spreadsheet/deduplication-utils.js.map +1 -1
- package/dist/cjs/spreadsheet/markdown-runs.js.map +1 -1
- package/dist/cjs/spreadsheet/range-operations.d.cts +2 -1
- package/dist/cjs/spreadsheet/range-operations.d.ts +2 -1
- package/dist/cjs/spreadsheet/range-operations.js +12 -0
- package/dist/cjs/spreadsheet/range-operations.js.map +1 -1
- package/dist/cjs/spreadsheet/sheet-operations.js.map +1 -1
- package/dist/cjs/spreadsheet/spreadsheet-management.js.map +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/create-store.js.map +1 -1
- package/dist/esm/lib/google-auth.js.map +1 -1
- package/dist/esm/mcp/index.js.map +1 -1
- package/dist/esm/mcp/prompts/a1-notation.js.map +1 -1
- package/dist/esm/mcp/prompts/index.js.map +1 -1
- package/dist/esm/mcp/resources/index.js.map +1 -1
- package/dist/esm/mcp/resources/spreadsheet.js.map +1 -1
- package/dist/esm/mcp/tools/cells-format.js.map +1 -1
- package/dist/esm/mcp/tools/cells-metadata-get.d.ts +95 -0
- package/dist/esm/mcp/tools/cells-metadata-get.js +155 -0
- package/dist/esm/mcp/tools/cells-metadata-get.js.map +1 -0
- package/dist/esm/mcp/tools/chart-create.js.map +1 -1
- package/dist/esm/mcp/tools/columns-get.js.map +1 -1
- package/dist/esm/mcp/tools/columns-update.js.map +1 -1
- package/dist/esm/mcp/tools/csv-get-columns.js.map +1 -1
- package/dist/esm/mcp/tools/dimensions-batch-update.js.map +1 -1
- package/dist/esm/mcp/tools/dimensions-move.js.map +1 -1
- package/dist/esm/mcp/tools/index.d.ts +2 -0
- package/dist/esm/mcp/tools/index.js +2 -0
- package/dist/esm/mcp/tools/index.js.map +1 -1
- package/dist/esm/mcp/tools/lib/dimension-operations.js.map +1 -1
- package/dist/esm/mcp/tools/rows-append.js.map +1 -1
- package/dist/esm/mcp/tools/rows-csv-append.js.map +1 -1
- package/dist/esm/mcp/tools/rows-get.js.map +1 -1
- package/dist/esm/mcp/tools/sheet-copy-to.js.map +1 -1
- package/dist/esm/mcp/tools/sheet-copy.js.map +1 -1
- package/dist/esm/mcp/tools/sheet-create.js.map +1 -1
- package/dist/esm/mcp/tools/sheet-delete.js.map +1 -1
- package/dist/esm/mcp/tools/sheet-find.js.map +1 -1
- package/dist/esm/mcp/tools/sheet-rename.js.map +1 -1
- package/dist/esm/mcp/tools/spreadsheet-copy.js.map +1 -1
- package/dist/esm/mcp/tools/spreadsheet-create.js.map +1 -1
- package/dist/esm/mcp/tools/spreadsheet-find.js.map +1 -1
- package/dist/esm/mcp/tools/spreadsheet-metadata-get.d.ts +59 -0
- package/dist/esm/mcp/tools/spreadsheet-metadata-get.js +89 -0
- package/dist/esm/mcp/tools/spreadsheet-metadata-get.js.map +1 -0
- package/dist/esm/mcp/tools/spreadsheet-rename.js.map +1 -1
- package/dist/esm/mcp/tools/validation-set.js.map +1 -1
- package/dist/esm/mcp/tools/values-batch-update.js.map +1 -1
- package/dist/esm/mcp/tools/values-clear.js.map +1 -1
- package/dist/esm/mcp/tools/values-csv-update.js.map +1 -1
- package/dist/esm/mcp/tools/values-markdown-update.js.map +1 -1
- package/dist/esm/mcp/tools/values-replace.js.map +1 -1
- package/dist/esm/mcp/tools/values-search.js.map +1 -1
- package/dist/esm/schemas/index.js.map +1 -1
- package/dist/esm/setup/config.js.map +1 -1
- package/dist/esm/setup/http.d.ts +1 -1
- package/dist/esm/setup/http.js.map +1 -1
- package/dist/esm/setup/index.js.map +1 -1
- package/dist/esm/setup/oauth-google.js.map +1 -1
- package/dist/esm/setup/runtime.js.map +1 -1
- package/dist/esm/setup/stdio.js.map +1 -1
- package/dist/esm/setup/version-help.js.map +1 -1
- package/dist/esm/spreadsheet/column-utilities.js.map +1 -1
- package/dist/esm/spreadsheet/csv-streaming.js.map +1 -1
- package/dist/esm/spreadsheet/data-operations.js.map +1 -1
- package/dist/esm/spreadsheet/deduplication-utils.js.map +1 -1
- package/dist/esm/spreadsheet/markdown-runs.js.map +1 -1
- package/dist/esm/spreadsheet/range-operations.d.ts +2 -1
- package/dist/esm/spreadsheet/range-operations.js +11 -2
- package/dist/esm/spreadsheet/range-operations.js.map +1 -1
- package/dist/esm/spreadsheet/sheet-operations.js.map +1 -1
- package/dist/esm/spreadsheet/spreadsheet-management.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@ Requires Node.js >=20. The examples use `npx`, included with npm, to run this se
|
|
|
7
7
|
## Common uses
|
|
8
8
|
|
|
9
9
|
- Find spreadsheets and sheets
|
|
10
|
+
- Inspect workbook structure and metadata in selected cells
|
|
10
11
|
- Append and update data
|
|
11
12
|
- Apply formatting, validation, and charts
|
|
12
13
|
|
|
@@ -53,7 +54,7 @@ it sends no `initialize` handshake and carries no session id.
|
|
|
53
54
|
|
|
54
55
|
1. Go to [Google Cloud Console](https://console.cloud.google.com/).
|
|
55
56
|
2. Create or select a project.
|
|
56
|
-
3. Enable the Google Sheets API.
|
|
57
|
+
3. Enable the Google Sheets API and Google Drive API.
|
|
57
58
|
4. Create OAuth 2.0 credentials (Desktop app).
|
|
58
59
|
5. Copy the Client ID and Client Secret.
|
|
59
60
|
6. Select the credential type that matches your transport:
|
|
@@ -176,32 +177,36 @@ npx -y @mcp-z/cli call-tool sheets spreadsheet-find '{"spreadsheetRef":"Quarterl
|
|
|
176
177
|
## Tools
|
|
177
178
|
|
|
178
179
|
1. cells-format
|
|
179
|
-
2.
|
|
180
|
-
3.
|
|
181
|
-
4. columns-
|
|
182
|
-
5.
|
|
183
|
-
6.
|
|
184
|
-
7. dimensions-
|
|
185
|
-
8.
|
|
186
|
-
9. rows-
|
|
187
|
-
10. rows-
|
|
188
|
-
11.
|
|
189
|
-
12. sheet-copy
|
|
190
|
-
13. sheet-
|
|
191
|
-
14. sheet-
|
|
192
|
-
15. sheet-
|
|
193
|
-
16. sheet-
|
|
194
|
-
17.
|
|
195
|
-
18. spreadsheet-
|
|
196
|
-
19. spreadsheet-
|
|
197
|
-
20. spreadsheet-
|
|
198
|
-
21.
|
|
199
|
-
22.
|
|
200
|
-
23.
|
|
201
|
-
24. values-
|
|
202
|
-
25. values-
|
|
203
|
-
26. values-
|
|
204
|
-
27. values-
|
|
180
|
+
2. cells-metadata-get
|
|
181
|
+
3. chart-create
|
|
182
|
+
4. columns-get
|
|
183
|
+
5. columns-update
|
|
184
|
+
6. csv-get-columns
|
|
185
|
+
7. dimensions-batch-update
|
|
186
|
+
8. dimensions-move
|
|
187
|
+
9. rows-append
|
|
188
|
+
10. rows-csv-append
|
|
189
|
+
11. rows-get
|
|
190
|
+
12. sheet-copy
|
|
191
|
+
13. sheet-copy-to
|
|
192
|
+
14. sheet-create
|
|
193
|
+
15. sheet-delete
|
|
194
|
+
16. sheet-find
|
|
195
|
+
17. sheet-rename
|
|
196
|
+
18. spreadsheet-copy
|
|
197
|
+
19. spreadsheet-create
|
|
198
|
+
20. spreadsheet-find
|
|
199
|
+
21. spreadsheet-metadata-get
|
|
200
|
+
22. spreadsheet-rename
|
|
201
|
+
23. validation-set
|
|
202
|
+
24. values-batch-update
|
|
203
|
+
25. values-clear
|
|
204
|
+
26. values-csv-update
|
|
205
|
+
27. values-markdown-update
|
|
206
|
+
28. values-replace
|
|
207
|
+
29. values-search
|
|
208
|
+
|
|
209
|
+
See [metadata usage](https://github.com/mcp-z/mcp-sheets/blob/master/usage/metadata.md) for workbook inspection and bounded cell reads.
|
|
205
210
|
|
|
206
211
|
## Resources
|
|
207
212
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/
|
|
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;;;;;+BAClDA;;;eAAAA;;;AAAN,IAAMA,eAAe"}
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/index.ts"],"sourcesContent":["import { handleVersionHelp } from './setup/version-help.ts';\nimport type { ServerConfig } from './types.ts';\n\nexport { GOOGLE_SCOPE } from './constants.ts';\nexport * as mcp from './mcp/index.ts';\nexport * as schemas from './schemas/index.ts';\nexport * as setup from './setup/index.ts';\nexport * from './types.ts';\n\nexport async function startServer(config: ServerConfig): Promise<void> {\n // createHTTPServer/createStdioServer pull in @mcp-z/server and every mcp/tools/*.ts\n // (googleapis included); deferred so a --version/--help run never reaches them.\n const { createHTTPServer } = await import('./setup/http.ts');\n const { createStdioServer } = await import('./setup/stdio.ts');\n const { logger, close } = config.transport.type === 'stdio' ? await createStdioServer(config) : await createHTTPServer(config);\n\n process.on('SIGINT', async () => {\n await close();\n process.exit(0);\n });\n\n logger.info(`Server started with ${config.transport.type} transport`);\n await new Promise(() => {});\n}\n\nexport default async function main(): Promise<void> {\n // Check for help/version flags FIRST, before config parsing\n const versionHelpResult = handleVersionHelp(process.argv);\n if (versionHelpResult.handled) {\n console.log(versionHelpResult.output);\n process.exit(0);\n }\n\n // Only parse config if no help/version flags. config.ts's own heavy imports (@mcp-z/oauth-google,\n // @mcp-z/server) are deferred internally, so this static-looking call stays cheap until here.\n const { createConfig } = await import('./setup/config.ts');\n const config = createConfig();\n await startServer(config);\n}\n\nif (process.argv[1] === new URL(import.meta.url).pathname) {\n main();\n}\n"],"names":["GOOGLE_SCOPE","main","mcp","schemas","setup","startServer","config","createHTTPServer","createStdioServer","logger","close","transport","type","process","on","exit","info","Promise","versionHelpResult","createConfig","handleVersionHelp","argv","handled","console","log","output","URL","pathname"],"mappings":";;;;;;;;;;;QAGSA;eAAAA,yBAAY;;QAsBrB;eAA8BC;;QArBlBC;;;QACAC;;;QACAC;;;QAGUC;eAAAA;;;6BATY;2BAGL;+DACR;gEACI;gEACF;qBACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEP,SAAeA,YAAYC,MAAoB;;YAG5CC,kBACAC,mBACkBF,MAAlBG,QAAQC;;;;oBAFa;;wBAAM;2EAAA,QAAO;;;;oBAAlCH,mBAAqB,cAArBA;oBACsB;;wBAAM;2EAAA,QAAO;;;;oBAAnCC,oBAAsB,cAAtBA;yBACkBF,CAAAA,OAAOK,SAAS,CAACC,IAAI,KAAK,OAAM,GAAhCN;;;;oBAAoC;;wBAAME,kBAAkBF;;;2BAAxB;;;;;;oBAAkC;;wBAAMC,iBAAiBD;;;2BAAvB;;;oBAAtEA,aAAlBG,SAAkBH,KAAlBG,QAAQC,QAAUJ,KAAVI;oBAEhBG,QAAQC,EAAE,CAAC,UAAU;;;;;wCACnB;;4CAAMJ;;;wCAAN;wCACAG,QAAQE,IAAI,CAAC;;;;;;wBACf;;oBAEAN,OAAOO,IAAI,CAAC,AAAC,uBAA4C,OAAtBV,OAAOK,SAAS,CAACC,IAAI,EAAC;oBACzD;;wBAAM,IAAIK,QAAQ,YAAO;;;oBAAzB;;;;;;IACF;;AAEe,SAAehB;;YAEtBiB,mBAQEC,cACFb;;;;oBAVN,4DAA4D;oBACtDY,oBAAoBE,IAAAA,gCAAiB,EAACP,QAAQQ,IAAI;oBACxD,IAAIH,kBAAkBI,OAAO,EAAE;wBAC7BC,QAAQC,GAAG,CAACN,kBAAkBO,MAAM;wBACpCZ,QAAQE,IAAI,CAAC;oBACf;oBAIyB;;wBAAM;2EAAA,QAAO;;;;oBAA9BI,eAAiB,cAAjBA;oBACFb,SAASa;oBACf;;wBAAMd,YAAYC;;;oBAAlB;;;;;;IACF;;AAEA,IAAIO,QAAQQ,IAAI,CAAC,EAAE,KAAK,IAAIK,IAAI,qDAAiBC,QAAQ,EAAE;IACzD1B;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/lib/create-store.ts"],"sourcesContent":["import type Keyv from 'keyv';\nimport keyvRegistry from 'keyv-registry';\n\n// keyv-file is a direct dependency so the default file:// URIs resolve; keyv-registry\n// loads adapters with require() rather than depending on any of them itself.\n\nexport default async function createStore<T>(uri: string): Promise<Keyv<T>> {\n const store = await keyvRegistry<T>(uri);\n if (!store) throw new Error(`Failed to create store for URI: ${uri}`);\n return store;\n}\n"],"names":["createStore","uri","store","keyvRegistry","Error"],"mappings":";;;;+BAGA,sFAAsF;AACtF,6EAA6E;AAE7E;;;eAA8BA;;;mEALL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKV,SAAeA,YAAeC,GAAW;;YAChDC;;;;oBAAQ;;wBAAMC,IAAAA,qBAAY,EAAIF;;;oBAA9BC,QAAQ;oBACd,IAAI,CAACA,OAAO,MAAM,IAAIE,MAAM,AAAC,mCAAsC,OAAJH;oBAC/D;;wBAAOC;;;;IACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/lib/google-auth.ts"],"sourcesContent":["import { auth as googleAuthPlus } from '@googleapis/sheets';\nimport { attachTokenProvider, type GoogleAuthProvider } from '@mcp-z/oauth-google';\n\n/**\n * A Google API client bound to this request's token provider.\n *\n * `@mcp-z/oauth-google` mints tokens and depends on no Google SDK, so the client\n * is built here, from this package's own `googleapis`. That keeps one copy of\n * `google-auth-library` in the tree by construction rather than by matching pins.\n */\nexport function googleAuth(auth: GoogleAuthProvider) {\n return attachTokenProvider(new googleAuthPlus.OAuth2(), auth);\n}\n"],"names":["googleAuth","auth","attachTokenProvider","googleAuthPlus","OAuth2"],"mappings":";;;;+BAUgBA;;;eAAAA;;;sBAVuB;2BACsB;AAStD,SAASA,WAAWC,IAAwB;IACjD,OAAOC,IAAAA,gCAAmB,EAAC,IAAIC,YAAc,CAACC,MAAM,IAAIH;AAC1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/mcp/index.ts"],"sourcesContent":["export * as promptFactories from './prompts/index.ts';\nexport * as resourceFactories from './resources/index.ts';\nexport * as toolFactories from './tools/index.ts';\n"],"names":["promptFactories","resourceFactories","toolFactories"],"mappings":";;;;;;;;;;;QAAYA;;;QACAC;;;QACAC;;;;+DAFqB;gEACE;gEACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/mcp/prompts/a1-notation.ts"],"sourcesContent":["import type { PromptModule, ServerContext } from '@mcp-z/server';\n\nexport default function createPrompt() {\n const config = {\n description: 'Reference guide for Google Sheets A1 notation syntax',\n };\n\n const handler = async (_args: { [x: string]: unknown }, _extra: ServerContext) => {\n return {\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: `# Google Sheets A1 Notation Reference\n\nA1 notation identifies cells and ranges in Google Sheets.\n\n## Cell References\n- \\`B5\\` - Single cell at column B, row 5\n- \\`A1\\` - Top-left cell\n\n## Range References\n- \\`A1:D10\\` - Rectangle from A1 to D10\n- \\`A5:D5\\` - Single row (columns A-D of row 5)\n- \\`B1:B10\\` - Single column segment (rows 1-10 of column B)\n\n## Full Row/Column References\n- \\`5:5\\` - Entire row 5\n- \\`B:B\\` - Entire column B\n- \\`A:D\\` - Columns A through D (all rows)\n- \\`1:10\\` - Rows 1 through 10 (all columns)\n\n## Common Patterns\n| Goal | Notation |\n|------|----------|\n| Get one cell | \\`B5\\` |\n| Get a row | \\`A5:Z5\\` or \\`5:5\\` |\n| Get a column | \\`B:B\\` or \\`B1:B1000\\` |\n| Get a data table | \\`A1:F100\\` |\n| Get headers | \\`1:1\\` or \\`A1:Z1\\` |`,\n },\n },\n ],\n };\n };\n\n return {\n name: 'a1-notation',\n config,\n handler,\n } satisfies PromptModule;\n}\n"],"names":["createPrompt","config","description","handler","_args","_extra","messages","role","content","type","text","name"],"mappings":";;;;+BAEA;;;eAAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAT,SAASA;IACtB,IAAMC,SAAS;QACbC,aAAa;IACf;IAEA,IAAMC,UAAU,iBAAOC,OAAiCC;;;gBACtD;;oBAAO;wBACLC,QAAQ;4BACN;gCACEC,MAAM;gCACNC,SAAS;oCACPC,MAAM;oCACNC,MAAM;gCA2BR;4BACF;;oBAEJ;;;QACF;;IAEA,OAAO;QACLC,MAAM;QACNV,QAAAA;QACAE,SAAAA;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/mcp/prompts/index.ts"],"sourcesContent":["export { default as a1Notation } from './a1-notation.ts';\n"],"names":["a1Notation"],"mappings":";;;;+BAAoBA;;;eAAAA,qBAAU;;;mEAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/mcp/resources/index.ts"],"sourcesContent":["export { default as spreadsheet } from './spreadsheet.ts';\n"],"names":["spreadsheet"],"mappings":";;;;+BAAoBA;;;eAAAA,sBAAW;;;oEAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/mcp/resources/spreadsheet.ts"],"sourcesContent":["import { type sheets_v4, sheets as sheetsApi } from '@googleapis/sheets';\nimport type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport type { ReadResourceResult, ResourceConfig, ResourceModule, ServerContext } from '@mcp-z/server';\nimport { ResourceTemplate } from '@mcp-z/server';\nimport { googleAuth } from '../../lib/google-auth.ts';\nimport type { GoogleApiError } from '../../types.ts';\n\nexport default function createResource(): ResourceModule {\n const template = new ResourceTemplate('sheets://spreadsheets/{spreadsheetId}', { list: undefined });\n const config: ResourceConfig = {\n description: 'Sheets spreadsheet resource',\n mimeType: 'application/json',\n };\n\n const handler = async (uri: URL, variables: Record<string, string | string[]>, extra: ServerContext): Promise<ReadResourceResult> => {\n const spreadsheetId = Array.isArray(variables.spreadsheetId) ? variables.spreadsheetId[0] : variables.spreadsheetId;\n\n if (!spreadsheetId) {\n return {\n contents: [\n {\n uri: uri.href,\n mimeType: 'application/json',\n text: JSON.stringify({ error: 'spreadsheetId is required' }),\n },\n ],\n };\n }\n\n try {\n // Safe type guard to access middleware-enriched extra\n const { logger, authContext } = extra as unknown as EnrichedExtra;\n const sheets = sheetsApi({ version: 'v4', auth: googleAuth(authContext.auth) });\n const resp = await sheets.spreadsheets.get({\n spreadsheetId,\n fields: 'spreadsheetId,properties.title,sheets.properties',\n });\n const data = resp.data as sheets_v4.Schema$Spreadsheet;\n logger.info('sheets-spreadsheet resource fetch success', {\n spreadsheetId: data.spreadsheetId,\n title: data?.properties?.title,\n sheetCount: (data?.sheets || []).length,\n });\n return {\n contents: [\n {\n uri: uri.href,\n mimeType: 'application/json',\n text: JSON.stringify({\n id: data?.spreadsheetId,\n title: data?.properties?.title,\n sheets: (data?.sheets || []).map((s) => ({\n id: s?.properties?.sheetId,\n title: s?.properties?.title,\n rowCount: s?.properties?.gridProperties?.rowCount,\n columnCount: s?.properties?.gridProperties?.columnCount,\n })),\n }),\n },\n ],\n };\n } catch (error) {\n const { logger } = extra as unknown as EnrichedExtra;\n logger.info('sheets-spreadsheet resource fetch failed', error as Record<string, unknown>);\n return {\n contents: [\n {\n uri: uri.href,\n mimeType: 'application/json',\n text: JSON.stringify({\n error: String((error as GoogleApiError)?.message ?? error),\n }),\n },\n ],\n };\n }\n };\n\n return {\n name: 'spreadsheet',\n template,\n config,\n handler,\n };\n}\n"],"names":["createResource","template","ResourceTemplate","list","undefined","config","description","mimeType","handler","uri","variables","extra","spreadsheetId","data","logger","authContext","sheets","resp","error","Array","isArray","contents","href","text","JSON","stringify","sheetsApi","version","auth","googleAuth","spreadsheets","get","fields","info","title","properties","sheetCount","length","id","map","s","sheetId","rowCount","gridProperties","columnCount","String","message","name"],"mappings":";;;;+BAOA;;;eAAwBA;;;sBAP4B;sBAGnB;4BACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGZ,SAASA;IACtB,IAAMC,WAAW,IAAIC,wBAAgB,CAAC,yCAAyC;QAAEC,MAAMC;IAAU;IACj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googleapis/sheets';\nimport type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport type { CallToolResult, ToolModule } from '@mcp-z/server';\nimport { ProtocolError, ProtocolErrorCode } from '@mcp-z/server';\nimport { z } from 'zod';\nimport { googleAuth } from '../../lib/google-auth.ts';\nimport { SheetGidOutput, SheetGidSchema, SpreadsheetIdOutput, SpreadsheetIdSchema } from '../../schemas/index.ts';\nimport { parseA1Notation, rangeReferenceToGridRange } from '../../spreadsheet/range-operations.ts';\n\n// RGB color schema (0-1 range for Google Sheets API)\nconst ColorSchema = z.object({\n red: z.number().min(0).max(1).describe('Red component (0-1)'),\n green: z.number().min(0).max(1).describe('Green component (0-1)'),\n blue: z.number().min(0).max(1).describe('Blue component (0-1)'),\n});\n\n// Number format schema\nconst NumberFormatSchema = z.object({\n type: z.enum(['TEXT', 'NUMBER', 'PERCENT', 'CURRENCY', 'DATE', 'TIME']).describe('Number format type'),\n pattern: z.string().optional().describe('Custom format pattern (e.g., \"$#,##0.00\" for currency)'),\n});\n\n// Border schema\nconst BorderSchema = z.object({\n style: z.enum(['SOLID', 'DASHED', 'DOTTED']).describe('Border line style'),\n color: ColorSchema.describe('Border color'),\n});\n\n// Input schema for format requests\nconst FormatRequestSchema = z.object({\n range: z.string().min(1).describe('A1 notation range to format (e.g., \"A1:D10\", \"B:B\", \"5:5\")'),\n backgroundColor: ColorSchema.optional().describe('Cell background color'),\n textColor: ColorSchema.optional().describe('Text color'),\n bold: z.boolean().optional().describe('Bold text'),\n fontSize: z.number().int().min(6).max(36).optional().describe('Font size in points'),\n horizontalAlignment: z.enum(['LEFT', 'CENTER', 'RIGHT']).optional().describe('Horizontal text alignment'),\n numberFormat: NumberFormatSchema.optional().describe('Number format pattern'),\n borders: BorderSchema.optional().describe('Cell borders'),\n});\n\nconst inputSchema = z.object({\n id: SpreadsheetIdSchema,\n gid: SheetGidSchema,\n requests: z.array(FormatRequestSchema).min(1).max(50).describe('Array of formatting requests. Batch multiple ranges for efficiency.'),\n});\n\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n id: SpreadsheetIdOutput,\n gid: SheetGidOutput,\n sheetTitle: z.string().describe('Title of the formatted sheet'),\n sheetUrl: z.string().describe('URL of the formatted sheet'),\n successCount: z.number().int().nonnegative().describe('Number of format requests successfully applied'),\n failedRanges: z\n .array(\n z.object({\n range: z.string().describe('A1 notation of range that failed'),\n error: z.string().describe('Why formatting failed for this range'),\n })\n )\n .optional()\n .describe('Only populated if some ranges failed to format'),\n});\n\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'Apply formatting (colors, borders, fonts, alignment, number formats) to cell ranges without modifying data. Supports batch operations for efficiency. Colors use 0-1 RGB format. Best for creating professional, visually organized spreadsheets.',\n inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\nasync function handler({ id, gid, requests }: Input, extra: EnrichedExtra): Promise<CallToolResult> {\n const logger = extra.logger;\n logger.info('sheets.cells.format called', {\n id,\n gid,\n requestCount: requests.length,\n });\n\n try {\n const sheets = sheetsApi({ version: 'v4', auth: googleAuth(extra.authContext.auth) });\n\n // Get spreadsheet and sheet info in single API call\n const spreadsheetResponse = await sheets.spreadsheets.get({\n spreadsheetId: id,\n fields: 'sheets.properties.sheetId,sheets.properties.title',\n });\n\n // Find sheet by gid\n const sheet = spreadsheetResponse.data.sheets?.find((s) => String(s.properties?.sheetId) === gid);\n if (!sheet?.properties) {\n logger.info('Sheet not found for format cells', { id, gid, requestCount: requests.length });\n throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Sheet not found: ${gid}`);\n }\n\n const sheetTitle = sheet.properties.title ?? gid;\n // googleapis types sheetId as `number | null | undefined`; coerce for rangeReferenceToGridRange below (same pattern as values-batch-update.ts's sheetGid).\n const sheetId = sheet.properties.sheetId ?? 0;\n const sheetUrl = `https://docs.google.com/spreadsheets/d/${id}/edit#gid=${sheetId}`;\n\n // Build batch update requests\n const batchRequests: sheets_v4.Schema$Request[] = [];\n const failedRanges: Array<{ range: string; error: string }> = [];\n\n for (const request of requests) {\n try {\n // Parse A1 notation to range reference\n const rangeRef = parseA1Notation(request.range);\n\n // Build grid range from range reference using helper function\n const gridRange = rangeReferenceToGridRange(rangeRef, sheetId);\n\n // Build cell format object\n const cellFormat: {\n backgroundColor?: sheets_v4.Schema$Color;\n textFormat?: sheets_v4.Schema$TextFormat;\n horizontalAlignment?: string;\n numberFormat?: sheets_v4.Schema$NumberFormat;\n } = {};\n const fields: string[] = [];\n\n // Background color\n if (request.backgroundColor) {\n cellFormat.backgroundColor = request.backgroundColor;\n fields.push('backgroundColor');\n }\n\n // Text format\n if (request.textColor || request.bold !== undefined || request.fontSize !== undefined) {\n cellFormat.textFormat = {};\n if (request.textColor) {\n cellFormat.textFormat.foregroundColor = request.textColor;\n fields.push('textFormat.foregroundColor');\n }\n if (request.bold !== undefined) {\n cellFormat.textFormat.bold = request.bold;\n fields.push('textFormat.bold');\n }\n if (request.fontSize !== undefined) {\n cellFormat.textFormat.fontSize = request.fontSize;\n fields.push('textFormat.fontSize');\n }\n }\n\n // Horizontal alignment\n if (request.horizontalAlignment) {\n cellFormat.horizontalAlignment = request.horizontalAlignment;\n fields.push('horizontalAlignment');\n }\n\n // Number format\n if (request.numberFormat) {\n const numberFormat: sheets_v4.Schema$NumberFormat = {\n type: request.numberFormat.type,\n };\n if (request.numberFormat.pattern !== undefined) {\n numberFormat.pattern = request.numberFormat.pattern;\n }\n cellFormat.numberFormat = numberFormat;\n fields.push('numberFormat');\n }\n\n // Add repeatCell request for this range\n if (fields.length > 0) {\n batchRequests.push({\n repeatCell: {\n range: gridRange,\n cell: {\n userEnteredFormat: cellFormat,\n },\n fields: `userEnteredFormat(${fields.join(',')})`,\n },\n });\n }\n\n // Add border formatting if specified\n if (request.borders) {\n batchRequests.push({\n updateBorders: {\n range: gridRange,\n top: {\n style: request.borders.style,\n color: request.borders.color,\n },\n bottom: {\n style: request.borders.style,\n color: request.borders.color,\n },\n left: {\n style: request.borders.style,\n color: request.borders.color,\n },\n right: {\n style: request.borders.style,\n color: request.borders.color,\n },\n },\n });\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.info('Failed to parse range for formatting', {\n range: request.range,\n error: message,\n });\n failedRanges.push({\n range: request.range,\n error: `Failed to parse range: ${message}`,\n });\n }\n }\n\n // Early return if all ranges failed\n if (batchRequests.length === 0) {\n const result: Output = {\n type: 'success' as const,\n id,\n gid: String(sheetId),\n sheetTitle,\n sheetUrl,\n successCount: 0,\n failedRanges: failedRanges.length > 0 ? failedRanges : undefined,\n };\n\n return {\n content: [{ type: 'text' as const, text: JSON.stringify(result) }],\n structuredContent: { result },\n };\n }\n\n logger.info('sheets.cells.format executing batch request', {\n spreadsheetId: id,\n sheetTitle,\n batchRequestsCount: batchRequests.length,\n });\n\n // Execute the batch update\n await sheets.spreadsheets.batchUpdate({\n spreadsheetId: id,\n requestBody: {\n requests: batchRequests,\n },\n });\n\n logger.info('sheets.cells.format completed successfully', {\n successCount: requests.length - failedRanges.length,\n failedCount: failedRanges.length,\n });\n\n const result: Output = {\n type: 'success' as const,\n id,\n gid: String(sheetId),\n sheetTitle,\n sheetUrl,\n successCount: requests.length - failedRanges.length,\n failedRanges: failedRanges.length > 0 ? failedRanges : undefined,\n };\n\n return {\n content: [{ type: 'text' as const, text: JSON.stringify(result) }],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('Format cells operation failed', {\n id,\n gid,\n requestCount: requests.length,\n error: message,\n });\n\n throw new ProtocolError(ProtocolErrorCode.InternalError, `Error formatting cells: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'cells-format',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","ColorSchema","z","object","red","number","min","max","describe","green","blue","NumberFormatSchema","type","enum","pattern","string","optional","BorderSchema","style","color","FormatRequestSchema","range","backgroundColor","textColor","bold","boolean","fontSize","int","horizontalAlignment","numberFormat","borders","inputSchema","id","SpreadsheetIdSchema","gid","SheetGidSchema","requests","array","successBranchSchema","literal","SpreadsheetIdOutput","SheetGidOutput","sheetTitle","sheetUrl","successCount","nonnegative","failedRanges","error","outputSchema","discriminatedUnion","config","description","result","handler","extra","logger","sheet","spreadsheetResponse","sheets","sheetId","batchRequests","request","rangeRef","gridRange","cellFormat","fields","message","info","requestCount","length","sheetsApi","version","auth","googleAuth","authContext","spreadsheets","get","spreadsheetId","data","find","s","String","properties","ProtocolError","ProtocolErrorCode","InvalidParams","title","parseA1Notation","rangeReferenceToGridRange","push","undefined","textFormat","foregroundColor","repeatCell","cell","userEnteredFormat","join","updateBorders","top","bottom","left","right","Error","content","text","JSON","stringify","structuredContent","batchRequestsCount","batchUpdate","requestBody","failedCount","InternalError","stack","name"],"mappings":";;;;+BAgSA;;;eAAwBA;;;sBAhS4B;2BAE5B;sBAKyB;mBAC/B;4BACS;uBAC8D;iCAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAP3D,IAAM,AAAEC,2BAA6BC,oBAAO,CAApCD;AASR,qDAAqD;AACrD,IAAME,cAAcC,MAAC,CAACC,MAAM,CAAC;IAC3BC,KAAKF,MAAC,CAACG,MAAM,GAAGC,GAAG,CAAC,GAAGC,GAAG,CAAC,GAAGC,QAAQ,CAAC;IACvCC,OAAOP,MAAC,CAACG,MAAM,GAAGC,GAAG,CAAC,GAAGC,GAAG,CAAC,GAAGC,QAAQ,CAAC;IACzCE,MAAMR,MAAC,CAACG,MA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AAGe,OAAOlC;oBAChEQ,OAAOR,KAAK,CAAC,iCAAiC;wBAC5Cf,IAAAA;wBACAE,KAAAA;wBACAkC,cAAchC,SAASiC,MAAM;wBAC7BtB,OAAOmB;oBACT;oBAEA,MAAM,IAAIiB,qBAAa,CAACC,yBAAiB,CAAC4B,aAAa,EAAE,AAAC,2BAAkC,OAAR9C,WAAW;wBAC7F+C,OAAOlE,AAAK,YAALA,OAAiBuD,SAAQvD,MAAMkE,KAAK,GAAGvB;oBAChD;;;;;;;IAEJ;;AAEe,SAAS5F;IACtB,OAAO;QACLoH,MAAM;QACNhE,QAAAA;QACAG,SAAAA;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/mcp/tools/cells-format.ts"],"sourcesContent":["import { type sheets_v4, sheets as sheetsApi } from '@googleapis/sheets';\nimport type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport type { CallToolResult, ToolModule } from '@mcp-z/server';\nimport { ProtocolError, ProtocolErrorCode } from '@mcp-z/server';\nimport { z } from 'zod';\nimport { googleAuth } from '../../lib/google-auth.ts';\nimport { SheetGidOutput, SheetGidSchema, SpreadsheetIdOutput, SpreadsheetIdSchema } from '../../schemas/index.ts';\nimport { parseA1Notation, rangeReferenceToGridRange } from '../../spreadsheet/range-operations.ts';\n\n// RGB color schema (0-1 range for Google Sheets API)\nconst ColorSchema = z.object({\n red: z.number().min(0).max(1).describe('Red component (0-1)'),\n green: z.number().min(0).max(1).describe('Green component (0-1)'),\n blue: z.number().min(0).max(1).describe('Blue component (0-1)'),\n});\n\n// Number format schema\nconst NumberFormatSchema = z.object({\n type: z.enum(['TEXT', 'NUMBER', 'PERCENT', 'CURRENCY', 'DATE', 'TIME']).describe('Number format type'),\n pattern: z.string().optional().describe('Custom format pattern (e.g., \"$#,##0.00\" for currency)'),\n});\n\n// Border schema\nconst BorderSchema = z.object({\n style: z.enum(['SOLID', 'DASHED', 'DOTTED']).describe('Border line style'),\n color: ColorSchema.describe('Border color'),\n});\n\n// Input schema for format requests\nconst FormatRequestSchema = z.object({\n range: z.string().min(1).describe('A1 notation range to format (e.g., \"A1:D10\", \"B:B\", \"5:5\")'),\n backgroundColor: ColorSchema.optional().describe('Cell background color'),\n textColor: ColorSchema.optional().describe('Text color'),\n bold: z.boolean().optional().describe('Bold text'),\n fontSize: z.number().int().min(6).max(36).optional().describe('Font size in points'),\n horizontalAlignment: z.enum(['LEFT', 'CENTER', 'RIGHT']).optional().describe('Horizontal text alignment'),\n numberFormat: NumberFormatSchema.optional().describe('Number format pattern'),\n borders: BorderSchema.optional().describe('Cell borders'),\n});\n\nconst inputSchema = z.object({\n id: SpreadsheetIdSchema,\n gid: SheetGidSchema,\n requests: z.array(FormatRequestSchema).min(1).max(50).describe('Array of formatting requests. Batch multiple ranges for efficiency.'),\n});\n\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n id: SpreadsheetIdOutput,\n gid: SheetGidOutput,\n sheetTitle: z.string().describe('Title of the formatted sheet'),\n sheetUrl: z.string().describe('URL of the formatted sheet'),\n successCount: z.number().int().nonnegative().describe('Number of format requests successfully applied'),\n failedRanges: z\n .array(\n z.object({\n range: z.string().describe('A1 notation of range that failed'),\n error: z.string().describe('Why formatting failed for this range'),\n })\n )\n .optional()\n .describe('Only populated if some ranges failed to format'),\n});\n\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'Apply formatting (colors, borders, fonts, alignment, number formats) to cell ranges without modifying data. Supports batch operations for efficiency. Colors use 0-1 RGB format. Best for creating professional, visually organized spreadsheets.',\n inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\nasync function handler({ id, gid, requests }: Input, extra: EnrichedExtra): Promise<CallToolResult> {\n const logger = extra.logger;\n logger.info('sheets.cells.format called', {\n id,\n gid,\n requestCount: requests.length,\n });\n\n try {\n const sheets = sheetsApi({ version: 'v4', auth: googleAuth(extra.authContext.auth) });\n\n // Get spreadsheet and sheet info in single API call\n const spreadsheetResponse = await sheets.spreadsheets.get({\n spreadsheetId: id,\n fields: 'sheets.properties.sheetId,sheets.properties.title',\n });\n\n // Find sheet by gid\n const sheet = spreadsheetResponse.data.sheets?.find((s) => String(s.properties?.sheetId) === gid);\n if (!sheet?.properties) {\n logger.info('Sheet not found for format cells', { id, gid, requestCount: requests.length });\n throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Sheet not found: ${gid}`);\n }\n\n const sheetTitle = sheet.properties.title ?? gid;\n // googleapis types sheetId as `number | null | undefined`; coerce for rangeReferenceToGridRange below (same pattern as values-batch-update.ts's sheetGid).\n const sheetId = sheet.properties.sheetId ?? 0;\n const sheetUrl = `https://docs.google.com/spreadsheets/d/${id}/edit#gid=${sheetId}`;\n\n // Build batch update requests\n const batchRequests: sheets_v4.Schema$Request[] = [];\n const failedRanges: Array<{ range: string; error: string }> = [];\n\n for (const request of requests) {\n try {\n // Parse A1 notation to range reference\n const rangeRef = parseA1Notation(request.range);\n\n // Build grid range from range reference using helper function\n const gridRange = rangeReferenceToGridRange(rangeRef, sheetId);\n\n // Build cell format object\n const cellFormat: {\n backgroundColor?: sheets_v4.Schema$Color;\n textFormat?: sheets_v4.Schema$TextFormat;\n horizontalAlignment?: string;\n numberFormat?: sheets_v4.Schema$NumberFormat;\n } = {};\n const fields: string[] = [];\n\n // Background color\n if (request.backgroundColor) {\n cellFormat.backgroundColor = request.backgroundColor;\n fields.push('backgroundColor');\n }\n\n // Text format\n if (request.textColor || request.bold !== undefined || request.fontSize !== undefined) {\n cellFormat.textFormat = {};\n if (request.textColor) {\n cellFormat.textFormat.foregroundColor = request.textColor;\n fields.push('textFormat.foregroundColor');\n }\n if (request.bold !== undefined) {\n cellFormat.textFormat.bold = request.bold;\n fields.push('textFormat.bold');\n }\n if (request.fontSize !== undefined) {\n cellFormat.textFormat.fontSize = request.fontSize;\n fields.push('textFormat.fontSize');\n }\n }\n\n // Horizontal alignment\n if (request.horizontalAlignment) {\n cellFormat.horizontalAlignment = request.horizontalAlignment;\n fields.push('horizontalAlignment');\n }\n\n // Number format\n if (request.numberFormat) {\n const numberFormat: sheets_v4.Schema$NumberFormat = {\n type: request.numberFormat.type,\n };\n if (request.numberFormat.pattern !== undefined) {\n numberFormat.pattern = request.numberFormat.pattern;\n }\n cellFormat.numberFormat = numberFormat;\n fields.push('numberFormat');\n }\n\n // Add repeatCell request for this range\n if (fields.length > 0) {\n batchRequests.push({\n repeatCell: {\n range: gridRange,\n cell: {\n userEnteredFormat: cellFormat,\n },\n fields: `userEnteredFormat(${fields.join(',')})`,\n },\n });\n }\n\n // Add border formatting if specified\n if (request.borders) {\n batchRequests.push({\n updateBorders: {\n range: gridRange,\n top: {\n style: request.borders.style,\n color: request.borders.color,\n },\n bottom: {\n style: request.borders.style,\n color: request.borders.color,\n },\n left: {\n style: request.borders.style,\n color: request.borders.color,\n },\n right: {\n style: request.borders.style,\n color: request.borders.color,\n },\n },\n });\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.info('Failed to parse range for formatting', {\n range: request.range,\n error: message,\n });\n failedRanges.push({\n range: request.range,\n error: `Failed to parse range: ${message}`,\n });\n }\n }\n\n // Early return if all ranges failed\n if (batchRequests.length === 0) {\n const result: Output = {\n type: 'success' as const,\n id,\n gid: String(sheetId),\n sheetTitle,\n sheetUrl,\n successCount: 0,\n failedRanges: failedRanges.length > 0 ? failedRanges : undefined,\n };\n\n return {\n content: [{ type: 'text' as const, text: JSON.stringify(result) }],\n structuredContent: { result },\n };\n }\n\n logger.info('sheets.cells.format executing batch request', {\n spreadsheetId: id,\n sheetTitle,\n batchRequestsCount: batchRequests.length,\n });\n\n // Execute the batch update\n await sheets.spreadsheets.batchUpdate({\n spreadsheetId: id,\n requestBody: {\n requests: batchRequests,\n },\n });\n\n logger.info('sheets.cells.format completed successfully', {\n successCount: requests.length - failedRanges.length,\n failedCount: failedRanges.length,\n });\n\n const result: Output = {\n type: 'success' as const,\n id,\n gid: String(sheetId),\n sheetTitle,\n sheetUrl,\n successCount: requests.length - failedRanges.length,\n failedRanges: failedRanges.length > 0 ? failedRanges : undefined,\n };\n\n return {\n content: [{ type: 'text' as const, text: JSON.stringify(result) }],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('Format cells operation failed', {\n id,\n gid,\n requestCount: requests.length,\n error: message,\n });\n\n throw new ProtocolError(ProtocolErrorCode.InternalError, `Error formatting cells: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'cells-format',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","ColorSchema","z","object","red","number","min","max","describe","green","blue","NumberFormatSchema","type","enum","pattern","string","optional","BorderSchema","style","color","FormatRequestSchema","range","backgroundColor","textColor","bold","boolean","fontSize","int","horizontalAlignment","numberFormat","borders","inputSchema","id","SpreadsheetIdSchema","gid","SheetGidSchema","requests","array","successBranchSchema","literal","SpreadsheetIdOutput","SheetGidOutput","sheetTitle","sheetUrl","successCount","nonnegative","failedRanges","error","outputSchema","discriminatedUnion","config","description","result","handler","extra","logger","sheet","spreadsheetResponse","sheets","sheetId","batchRequests","request","rangeRef","gridRange","cellFormat","fields","message","info","requestCount","length","sheetsApi","version","auth","googleAuth","authContext","spreadsheets","get","spreadsheetId","data","find","s","String","properties","ProtocolError","ProtocolErrorCode","InvalidParams","title","parseA1Notation","rangeReferenceToGridRange","push","undefined","textFormat","foregroundColor","repeatCell","cell","userEnteredFormat","join","updateBorders","top","bottom","left","right","Error","content","text","JSON","stringify","structuredContent","batchRequestsCount","batchUpdate","requestBody","failedCount","InternalError","stack","name"],"mappings":";;;;+BAgSA;;;eAAwBA;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8CAA8C;wBACxDvB,cAAcR,SAASiC,MAAM,GAAGvB,aAAauB,MAAM;wBACnD0C,aAAajE,aAAauB,MAAM;oBAClC;oBAEMjB,UAAiB;wBACrBxC,MAAM;wBACNoB,IAAAA;wBACAE,KAAK+C,OAAOtB;wBACZjB,YAAAA;wBACAC,UAAAA;wBACAC,cAAcR,SAASiC,MAAM,GAAGvB,aAAauB,MAAM;wBACnDvB,cAAcA,aAAauB,MAAM,GAAG,IAAIvB,eAAe4C;oBACzD;oBAEA;;wBAAO;4BACLa,OAAO;gCAAG;oCAAE3F,MAAM;oCAAiB4F,MAAMC,KAAKC,SAAS,CAACtD;gCAAQ;;4BAChEuD,mBAAmB;gCAAEvD,QAAAA;4BAAO;wBAC9B;;;oBACOL;oBACDmB,WAAUnB,AAAK,YAALA,OAAiBuD,SAAQvD,MAAMmB,OAAO,GAAGe,OAAOlC;oBAChEQ,OAAOR,KAAK,CAAC,iCAAiC;wBAC5Cf,IAAAA;wBACAE,KAAAA;wBACAkC,cAAchC,SAASiC,MAAM;wBAC7BtB,OAAOmB;oBACT;oBAEA,MAAM,IAAIiB,qBAAa,CAACC,yBAAiB,CAAC4B,aAAa,EAAE,AAAC,2BAAkC,OAAR9C,WAAW;wBAC7F+C,OAAOlE,AAAK,YAALA,OAAiBuD,SAAQvD,MAAMkE,KAAK,GAAGvB;oBAChD;;;;;;;IAEJ;;AAEe,SAAS5F;IACtB,OAAO;QACLoH,MAAM;QACNhE,QAAAA;QACAG,SAAAA;IACF;AACF"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { EnrichedExtra } from '@mcp-z/oauth-google';
|
|
2
|
+
import type { CallToolResult } from '@mcp-z/server';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
declare const inputSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
gid: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
7
|
+
ranges: z.ZodArray<z.ZodString>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10
|
+
type: z.ZodLiteral<"success">;
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
gid: z.ZodString;
|
|
13
|
+
metadata: z.ZodObject<{
|
|
14
|
+
spreadsheetId: z.ZodString;
|
|
15
|
+
sheets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
16
|
+
properties: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
sheetId: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
title: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$loose>>;
|
|
20
|
+
data: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
|
+
startRow: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
startColumn: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
rowData: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
24
|
+
values: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
25
|
+
note: z.ZodOptional<z.ZodString>;
|
|
26
|
+
dataValidation: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
27
|
+
pivotTable: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
28
|
+
dataSourceTable: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
29
|
+
}, z.core.$loose>>>;
|
|
30
|
+
}, z.core.$loose>>>;
|
|
31
|
+
}, z.core.$loose>>>;
|
|
32
|
+
}, z.core.$loose>>>;
|
|
33
|
+
}, z.core.$loose>;
|
|
34
|
+
fieldMask: z.ZodString;
|
|
35
|
+
requestedRanges: z.ZodArray<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
type: z.ZodLiteral<"auth_required">;
|
|
38
|
+
provider: z.ZodString;
|
|
39
|
+
message: z.ZodString;
|
|
40
|
+
url: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, z.core.$strip>], "type">;
|
|
42
|
+
export type Input = z.infer<typeof inputSchema>;
|
|
43
|
+
export type Output = z.infer<typeof outputSchema>;
|
|
44
|
+
declare function handler(input: Input, extra: EnrichedExtra): Promise<CallToolResult>;
|
|
45
|
+
export default function createTool(): {
|
|
46
|
+
name: string;
|
|
47
|
+
config: {
|
|
48
|
+
readonly description: "Read notes, data validation rules, pivot table and data-source table definitions in required finite ranges on one sheet. Preserves sparse row/column offsets. Excludes cell values, formulas and direct formatting. DATA_SOURCE and OBJECT sheets are unsupported.";
|
|
49
|
+
readonly annotations: {
|
|
50
|
+
readonly readOnlyHint: true;
|
|
51
|
+
};
|
|
52
|
+
readonly inputSchema: z.ZodObject<{
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
gid: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
55
|
+
ranges: z.ZodArray<z.ZodString>;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
readonly outputSchema: z.ZodObject<{
|
|
58
|
+
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
59
|
+
type: z.ZodLiteral<"success">;
|
|
60
|
+
id: z.ZodString;
|
|
61
|
+
gid: z.ZodString;
|
|
62
|
+
metadata: z.ZodObject<{
|
|
63
|
+
spreadsheetId: z.ZodString;
|
|
64
|
+
sheets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
65
|
+
properties: z.ZodOptional<z.ZodObject<{
|
|
66
|
+
sheetId: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
title: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, z.core.$loose>>;
|
|
69
|
+
data: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
70
|
+
startRow: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
startColumn: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
rowData: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
73
|
+
values: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
74
|
+
note: z.ZodOptional<z.ZodString>;
|
|
75
|
+
dataValidation: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
76
|
+
pivotTable: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
77
|
+
dataSourceTable: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
78
|
+
}, z.core.$loose>>>;
|
|
79
|
+
}, z.core.$loose>>>;
|
|
80
|
+
}, z.core.$loose>>>;
|
|
81
|
+
}, z.core.$loose>>>;
|
|
82
|
+
}, z.core.$loose>;
|
|
83
|
+
fieldMask: z.ZodString;
|
|
84
|
+
requestedRanges: z.ZodArray<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
86
|
+
type: z.ZodLiteral<"auth_required">;
|
|
87
|
+
provider: z.ZodString;
|
|
88
|
+
message: z.ZodString;
|
|
89
|
+
url: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, z.core.$strip>], "type">;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
};
|
|
93
|
+
handler: typeof handler;
|
|
94
|
+
};
|
|
95
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { EnrichedExtra } from '@mcp-z/oauth-google';
|
|
2
|
+
import type { CallToolResult } from '@mcp-z/server';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
declare const inputSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
gid: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
7
|
+
ranges: z.ZodArray<z.ZodString>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10
|
+
type: z.ZodLiteral<"success">;
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
gid: z.ZodString;
|
|
13
|
+
metadata: z.ZodObject<{
|
|
14
|
+
spreadsheetId: z.ZodString;
|
|
15
|
+
sheets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
16
|
+
properties: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
sheetId: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
title: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$loose>>;
|
|
20
|
+
data: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
|
+
startRow: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
startColumn: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
rowData: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
24
|
+
values: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
25
|
+
note: z.ZodOptional<z.ZodString>;
|
|
26
|
+
dataValidation: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
27
|
+
pivotTable: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
28
|
+
dataSourceTable: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
29
|
+
}, z.core.$loose>>>;
|
|
30
|
+
}, z.core.$loose>>>;
|
|
31
|
+
}, z.core.$loose>>>;
|
|
32
|
+
}, z.core.$loose>>>;
|
|
33
|
+
}, z.core.$loose>;
|
|
34
|
+
fieldMask: z.ZodString;
|
|
35
|
+
requestedRanges: z.ZodArray<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
type: z.ZodLiteral<"auth_required">;
|
|
38
|
+
provider: z.ZodString;
|
|
39
|
+
message: z.ZodString;
|
|
40
|
+
url: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, z.core.$strip>], "type">;
|
|
42
|
+
export type Input = z.infer<typeof inputSchema>;
|
|
43
|
+
export type Output = z.infer<typeof outputSchema>;
|
|
44
|
+
declare function handler(input: Input, extra: EnrichedExtra): Promise<CallToolResult>;
|
|
45
|
+
export default function createTool(): {
|
|
46
|
+
name: string;
|
|
47
|
+
config: {
|
|
48
|
+
readonly description: "Read notes, data validation rules, pivot table and data-source table definitions in required finite ranges on one sheet. Preserves sparse row/column offsets. Excludes cell values, formulas and direct formatting. DATA_SOURCE and OBJECT sheets are unsupported.";
|
|
49
|
+
readonly annotations: {
|
|
50
|
+
readonly readOnlyHint: true;
|
|
51
|
+
};
|
|
52
|
+
readonly inputSchema: z.ZodObject<{
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
gid: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
55
|
+
ranges: z.ZodArray<z.ZodString>;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
readonly outputSchema: z.ZodObject<{
|
|
58
|
+
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
59
|
+
type: z.ZodLiteral<"success">;
|
|
60
|
+
id: z.ZodString;
|
|
61
|
+
gid: z.ZodString;
|
|
62
|
+
metadata: z.ZodObject<{
|
|
63
|
+
spreadsheetId: z.ZodString;
|
|
64
|
+
sheets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
65
|
+
properties: z.ZodOptional<z.ZodObject<{
|
|
66
|
+
sheetId: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
title: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, z.core.$loose>>;
|
|
69
|
+
data: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
70
|
+
startRow: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
startColumn: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
rowData: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
73
|
+
values: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
74
|
+
note: z.ZodOptional<z.ZodString>;
|
|
75
|
+
dataValidation: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
76
|
+
pivotTable: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
77
|
+
dataSourceTable: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
78
|
+
}, z.core.$loose>>>;
|
|
79
|
+
}, z.core.$loose>>>;
|
|
80
|
+
}, z.core.$loose>>>;
|
|
81
|
+
}, z.core.$loose>>>;
|
|
82
|
+
}, z.core.$loose>;
|
|
83
|
+
fieldMask: z.ZodString;
|
|
84
|
+
requestedRanges: z.ZodArray<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
86
|
+
type: z.ZodLiteral<"auth_required">;
|
|
87
|
+
provider: z.ZodString;
|
|
88
|
+
message: z.ZodString;
|
|
89
|
+
url: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, z.core.$strip>], "type">;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
};
|
|
93
|
+
handler: typeof handler;
|
|
94
|
+
};
|
|
95
|
+
export {};
|