Google Docs, Sheets, Drive & Apps Script
You have access to a CLI tool gdoc that performs all Google Docs, Sheets, Drive, and Apps Script operations. Run it via:
node ~/.claude/skills/docmcp/scripts/gdoc.mjs <command> [options-as-json]
All commands accept a single JSON argument. Output is always JSON.
Authentication
The tool uses OAuth tokens stored at ~/.config/gcloud/docmcp/token.json. If tokens are missing, tell the user to run:
node ~/.claude/skills/docmcp/scripts/gdoc.mjs auth
This prints an auth URL. The user visits it, authorizes, and tokens are saved automatically.
Commands Reference
Google Docs
| Command |
JSON Args |
Description |
docs.create |
{"title": "..."} |
Create a new doc |
docs.read |
{"doc_id": "..."} |
Read doc text content |
docs.edit |
{"doc_id": "...", "old_text": "...", "new_text": "...", "replace_all": false} |
Replace text in doc |
docs.insert |
{"doc_id": "...", "text": "...", "position": "end"} |
Insert text (position: "end", text-to-insert-after, or index number) |
docs.delete |
{"doc_id": "...", "text": "...", "delete_all": false} |
Delete text from doc |
docs.format |
{"doc_id": "...", "search_text": "...", ...formatting} |
Format text (bold, italic, underline, strikethrough, font_size, font_family, foreground_color, background_color, heading, alignment) |
docs.insert_table |
{"doc_id": "...", "rows": 3, "cols": 3, "position": "end"} |
Insert table |
docs.get_info |
{"doc_id": "..."} |
Get doc metadata |
docs.get_structure |
{"doc_id": "..."} |
Get headings hierarchy |
docs.get_sections |
{"doc_id": "..."} |
Parse sections with indices |
docs.section |
`{"doc_id": "...", "action": "delete |
move |
docs.image |
`{"doc_id": "...", "action": "insert |
list |
docs.batch |
{"doc_id": "...", "operations": [...]} |
Batch operations (type: insert/delete/format with params) |
docs.list |
{"max_results": 20, "query": "..."} |
List docs |
Google Sheets
| Command |
JSON Args |
Description |
sheets.create |
{"title": "..."} |
Create spreadsheet |
sheets.read |
{"sheet_id": "...", "range": "Sheet1"} |
Read values from range |
sheets.edit |
{"sheet_id": "...", "range": "A1:B2", "values": [[...]]} |
Update range values |
sheets.insert |
{"sheet_id": "...", "values": [[...]], "range": "Sheet1"} |
Append rows |
sheets.get_cell |
{"sheet_id": "...", "cell": "A1"} |
Get cell value |
sheets.set_cell |
{"sheet_id": "...", "cell": "A1", "value": "..."} |
Set cell value |
sheets.edit_cell |
{"sheet_id": "...", "cell": "A1", "old_text": "...", "new_text": "...", "replace_all": false} |
Replace text in cell |
sheets.find_replace |
{"sheet_id": "...", "find": "...", "replace": "...", "sheet_name": null} |
Find/replace across sheet |
sheets.get_info |
{"sheet_id": "..."} |
Get spreadsheet metadata |
sheets.list |
{"max_results": 20, "query": "..."} |
List spreadsheets |
sheets.tab |
`{"sheet_id": "...", "action": "add |
delete |
sheets.clear |
{"sheet_id": "...", "range": "A1:B2", "clear_formats": false} |
Clear range |
sheets.format |
{"sheet_id": "...", "range": "A1:B2", ...formatting} |
Format range (background_color, text_color, bold, italic, font_size, font_family, horizontal_alignment, vertical_alignment, wrap_strategy, number_format, borders) |
sheets.merge |
`{"sheet_id": "...", "range": "A1:B2", "action": "merge |
unmerge"}` |
sheets.freeze |
{"sheet_id": "...", "sheet_name": "...", "rows": 1, "columns": 0} |
Freeze rows/columns |
sheets.sort |
{"sheet_id": "...", "range": "A1:C10", "sort_column": "A", "ascending": true} |
Sort range |
sheets.rows_cols |
`{"sheet_id": "...", "sheet_name": "...", "action": "insert |
delete", "dimension": "ROW |
sheets.dimension_size |
`{"sheet_id": "...", "sheet_name": "...", "dimension": "COLUMN |
ROW", "start": "A", "end": "C", "size": 150}` |
sheets.get_formula |
{"sheet_id": "...", "cell": "A1"} |
Get cell formula and value |
sheets.batch |
{"sheet_id": "...", "operations": [...]} |
Batch operations (type: setValue/format) |
Google Drive
| Command |
JSON Args |
Description |
drive.search |
`{"query": "...", "type": "all |
docs |
Apps Script
| Command |
JSON Args |
Description |
scripts.create |
{"sheet_id": "...", "script_name": "..."} |
Create script project |
scripts.list |
{"sheet_id": "..."} |
List scripts |
scripts.read |
{"sheet_id": "...", "script": "name-or-index"} |
Read script files |
scripts.write |
`{"sheet_id": "...", "script": "...", "file_name": "...", "content": "...", "file_type": "SERVER_JS |
HTML"}` |
scripts.edit |
{"sheet_id": "...", "script": "...", "file_name": "...", "old_text": "...", "new_text": "...", "replace_all": false} |
Edit script file |
scripts.delete |
{"sheet_id": "...", "script": "..."} |
Remove script tracking |
scripts.run |
{"sheet_id": "...", "script": "...", "function_name": "...", "parameters": []} |
Execute script function |
scripts.sync |
{"sheet_id": "..."} |
Sync and verify scripts |
Gmail
| Command |
JSON Args |
Description |
gmail.list_messages |
{"query": "...", "max_results": 10} |
List messages (query examples: "from:example@example.com", "is:unread", "subject:meeting") |
gmail.get_message |
{"message_id": "...", "format": "full"} |
Get message details (format: full, minimal, raw, metadata) |
gmail.send_message |
{"to": "...", "subject": "...", "body": "...", "from": "...", "cc": ["..."], "bcc": ["..."]} |
Send email |
gmail.list_threads |
{"query": "...", "max_results": 10} |
List threads |
gmail.get_thread |
{"thread_id": "...", "format": "full"} |
Get thread details |
gmail.modify_message |
{"message_id": "...", "add_labels": ["..."], "remove_labels": ["..."]} |
Modify message labels |
gmail.mark_as_read |
{"message_id": "..."} |
Mark message as read |
gmail.mark_as_unread |
{"message_id": "..."} |
Mark message as unread |
gmail.trash_message |
{"message_id": "..."} |
Move message to trash |
gmail.untrash_message |
{"message_id": "..."} |
Restore message from trash |
gmail.delete_message |
{"message_id": "..."} |
Permanently delete message |
gmail.list_labels |
{} |
List all Gmail labels |
gmail.get_label |
{"label_id": "..."} |
Get label details |
Usage Pattern
Always use this exact invocation pattern:
node ~/.claude/skills/docmcp/scripts/gdoc.mjs <command> '<json-args>'
Example: Create a document:
node ~/.claude/skills/docmcp/scripts/gdoc.mjs docs.create '{"title":"Meeting Notes"}'
Example: Read a spreadsheet:
node ~/.claude/skills/docmcp/scripts/gdoc.mjs sheets.read '{"sheet_id":"1abc...xyz","range":"Sheet1!A1:D10"}'
Example: Format text bold in a doc:
node ~/.claude/skills/docmcp/scripts/gdoc.mjs docs.format '{"doc_id":"1abc...xyz","search_text":"Important","bold":true}'
For detailed API reference with all field options, see reference.md.
For usage examples, see examples.md.
1---2name: docmcp3description: Google Docs, Sheets, Drive, Apps Script, and Gmail operations. Use when creating, reading, editing, or formatting Google Docs and Sheets. Use when searching Google Drive. Use when managing Apps Script projects. Use when sending, receiving, and managing Gmail messages.4---56# Google Docs, Sheets, Drive & Apps Script78You have access to a CLI tool `gdoc` that performs all Google Docs, Sheets, Drive, and Apps Script operations. Run it via:910```bash11node ~/.claude/skills/docmcp/scripts/gdoc.mjs <command> [options-as-json]12```1314All commands accept a single JSON argument. Output is always JSON.1516## Authentication1718The tool uses OAuth tokens stored at `~/.config/gcloud/docmcp/token.json`. If tokens are missing, tell the user to run:1920```bash21node ~/.claude/skills/docmcp/scripts/gdoc.mjs auth22```2324This prints an auth URL. The user visits it, authorizes, and tokens are saved automatically.2526## Commands Reference2728### Google Docs2930| Command | JSON Args | Description |31|---------|-----------|-------------|32| `docs.create` | `{"title": "..."}` | Create a new doc |33| `docs.read` | `{"doc_id": "..."}` | Read doc text content |34| `docs.edit` | `{"doc_id": "...", "old_text": "...", "new_text": "...", "replace_all": false}` | Replace text in doc |35| `docs.insert` | `{"doc_id": "...", "text": "...", "position": "end"}` | Insert text (position: "end", text-to-insert-after, or index number) |36| `docs.delete` | `{"doc_id": "...", "text": "...", "delete_all": false}` | Delete text from doc |37| `docs.format` | `{"doc_id": "...", "search_text": "...", ...formatting}` | Format text (bold, italic, underline, strikethrough, font_size, font_family, foreground_color, background_color, heading, alignment) |38| `docs.insert_table` | `{"doc_id": "...", "rows": 3, "cols": 3, "position": "end"}` | Insert table |39| `docs.get_info` | `{"doc_id": "..."}` | Get doc metadata |40| `docs.get_structure` | `{"doc_id": "..."}` | Get headings hierarchy |41| `docs.get_sections` | `{"doc_id": "..."}` | Parse sections with indices |42| `docs.section` | `{"doc_id": "...", "action": "delete|move|replace", "section": "name-or-index", ...}` | Manage sections (target for move, content + preserve_heading for replace) |43| `docs.image` | `{"doc_id": "...", "action": "insert|list|delete|replace", ...}` | Manage images (image_url, image_index, position, width, height) |44| `docs.batch` | `{"doc_id": "...", "operations": [...]}` | Batch operations (type: insert/delete/format with params) |45| `docs.list` | `{"max_results": 20, "query": "..."}` | List docs |4647### Google Sheets4849| Command | JSON Args | Description |50|---------|-----------|-------------|51| `sheets.create` | `{"title": "..."}` | Create spreadsheet |52| `sheets.read` | `{"sheet_id": "...", "range": "Sheet1"}` | Read values from range |53| `sheets.edit` | `{"sheet_id": "...", "range": "A1:B2", "values": [[...]]}` | Update range values |54| `sheets.insert` | `{"sheet_id": "...", "values": [[...]], "range": "Sheet1"}` | Append rows |55| `sheets.get_cell` | `{"sheet_id": "...", "cell": "A1"}` | Get cell value |56| `sheets.set_cell` | `{"sheet_id": "...", "cell": "A1", "value": "..."}` | Set cell value |57| `sheets.edit_cell` | `{"sheet_id": "...", "cell": "A1", "old_text": "...", "new_text": "...", "replace_all": false}` | Replace text in cell |58| `sheets.find_replace` | `{"sheet_id": "...", "find": "...", "replace": "...", "sheet_name": null}` | Find/replace across sheet |59| `sheets.get_info` | `{"sheet_id": "..."}` | Get spreadsheet metadata |60| `sheets.list` | `{"max_results": 20, "query": "..."}` | List spreadsheets |61| `sheets.tab` | `{"sheet_id": "...", "action": "add|delete|rename", "title": "...", "sheet_name": "..."}` | Manage tabs |62| `sheets.clear` | `{"sheet_id": "...", "range": "A1:B2", "clear_formats": false}` | Clear range |63| `sheets.format` | `{"sheet_id": "...", "range": "A1:B2", ...formatting}` | Format range (background_color, text_color, bold, italic, font_size, font_family, horizontal_alignment, vertical_alignment, wrap_strategy, number_format, borders) |64| `sheets.merge` | `{"sheet_id": "...", "range": "A1:B2", "action": "merge|unmerge"}` | Merge/unmerge cells |65| `sheets.freeze` | `{"sheet_id": "...", "sheet_name": "...", "rows": 1, "columns": 0}` | Freeze rows/columns |66| `sheets.sort` | `{"sheet_id": "...", "range": "A1:C10", "sort_column": "A", "ascending": true}` | Sort range |67| `sheets.rows_cols` | `{"sheet_id": "...", "sheet_name": "...", "action": "insert|delete", "dimension": "ROW|COLUMN", "start_index": 0, "count": 1}` | Insert/delete rows or columns |68| `sheets.dimension_size` | `{"sheet_id": "...", "sheet_name": "...", "dimension": "COLUMN|ROW", "start": "A", "end": "C", "size": 150}` | Set column width or row height |69| `sheets.get_formula` | `{"sheet_id": "...", "cell": "A1"}` | Get cell formula and value |70| `sheets.batch` | `{"sheet_id": "...", "operations": [...]}` | Batch operations (type: setValue/format) |7172### Google Drive7374| Command | JSON Args | Description |75|---------|-----------|-------------|76| `drive.search` | `{"query": "...", "type": "all|docs|sheets", "max_results": 20}` | Search Drive |7778### Apps Script7980| Command | JSON Args | Description |81|---------|-----------|-------------|82| `scripts.create` | `{"sheet_id": "...", "script_name": "..."}` | Create script project |83| `scripts.list` | `{"sheet_id": "..."}` | List scripts |84| `scripts.read` | `{"sheet_id": "...", "script": "name-or-index"}` | Read script files |85| `scripts.write` | `{"sheet_id": "...", "script": "...", "file_name": "...", "content": "...", "file_type": "SERVER_JS|HTML"}` | Write script file |86| `scripts.edit` | `{"sheet_id": "...", "script": "...", "file_name": "...", "old_text": "...", "new_text": "...", "replace_all": false}` | Edit script file |87| `scripts.delete` | `{"sheet_id": "...", "script": "..."}` | Remove script tracking |88| `scripts.run` | `{"sheet_id": "...", "script": "...", "function_name": "...", "parameters": []}` | Execute script function |89| `scripts.sync` | `{"sheet_id": "..."}` | Sync and verify scripts |9091### Gmail9293| Command | JSON Args | Description |94|---------|-----------|-------------|95| `gmail.list_messages` | `{"query": "...", "max_results": 10}` | List messages (query examples: "from:example@example.com", "is:unread", "subject:meeting") |96| `gmail.get_message` | `{"message_id": "...", "format": "full"}` | Get message details (format: full, minimal, raw, metadata) |97| `gmail.send_message` | `{"to": "...", "subject": "...", "body": "...", "from": "...", "cc": ["..."], "bcc": ["..."]}` | Send email |98| `gmail.list_threads` | `{"query": "...", "max_results": 10}` | List threads |99| `gmail.get_thread` | `{"thread_id": "...", "format": "full"}` | Get thread details |100| `gmail.modify_message` | `{"message_id": "...", "add_labels": ["..."], "remove_labels": ["..."]}` | Modify message labels |101| `gmail.mark_as_read` | `{"message_id": "..."}` | Mark message as read |102| `gmail.mark_as_unread` | `{"message_id": "..."}` | Mark message as unread |103| `gmail.trash_message` | `{"message_id": "..."}` | Move message to trash |104| `gmail.untrash_message` | `{"message_id": "..."}` | Restore message from trash |105| `gmail.delete_message` | `{"message_id": "..."}` | Permanently delete message |106| `gmail.list_labels` | `{}` | List all Gmail labels |107| `gmail.get_label` | `{"label_id": "..."}` | Get label details |108109## Usage Pattern110111Always use this exact invocation pattern:112113```bash114node ~/.claude/skills/docmcp/scripts/gdoc.mjs <command> '<json-args>'115```116117Example: Create a document:118```bash119node ~/.claude/skills/docmcp/scripts/gdoc.mjs docs.create '{"title":"Meeting Notes"}'120```121122Example: Read a spreadsheet:123```bash124node ~/.claude/skills/docmcp/scripts/gdoc.mjs sheets.read '{"sheet_id":"1abc...xyz","range":"Sheet1!A1:D10"}'125```126127Example: Format text bold in a doc:128```bash129node ~/.claude/skills/docmcp/scripts/gdoc.mjs docs.format '{"doc_id":"1abc...xyz","search_text":"Important","bold":true}'130```131132For detailed API reference with all field options, see [reference.md](reference.md).133For usage examples, see [examples.md](examples.md).