Google Docs
The Google Docs connector lets AI agents read, create, and edit documents — from fetching full document content and revision history to inserting text, replacing patterns, and applying complex batch updates. All operations go through the official Google Docs API using OAuth 2.0, with credentials stored encrypted in MCPGate's vault.
Required scopes#
MCPGate requests the following OAuth scopes when you connect a Google Docs account. All scopes are requested up front so you don't need to re-authorise when enabling additional tools.
| Scope | Purpose |
|---|---|
| documents.readonly | Read document content and metadata |
| documents | Create and edit documents |
| drive.readonly | List documents via Drive API |
| drive | Access document revision history |
Tool reference#
The Google Docs connector exposes 8 tools: 3 read, 4 write, and 1 delete. Use the MCP Apps page to enable or disable individual tools per app, and the Guardrails page to add fine-grained rules on top.
| Tool | Category | Description |
|---|---|---|
| googledocs_get_document | read | Get the full content and metadata of a Google Doc |
| googledocs_list_documents | read | List Google Docs documents in the user's Drive |
| googledocs_get_revision | read | Get a specific revision of a Google Doc via the Drive revisions API |
| googledocs_create_document | write | Create a new Google Docs document with an optional title |
| googledocs_batch_update | write | Apply one or more batch update requests to a Google Doc |
| googledocs_insert_text | write | Insert text at a specific index in a Google Doc |
| googledocs_replace_text | write | Replace all occurrences of a text pattern in a Google Doc |
| googledocs_delete_content | delete | Delete a range of content from a Google Doc |
Indexes are character positions
googledocs_insert_text and googledocs_delete_content use character-based indexes from the Docs structural model. Index 1 is the start of the document body. Reading the document first with googledocs_get_document gives you the current index positions of all elements.Common guardrail recipes#
Read-only access#
Enable only the three read tools and deny all write and delete tools. Use this for agents that summarise, proofread, or extract data from documents without ever modifying them.
Edit preset (no create or delete)#
Enable read tools plus googledocs_batch_update, googledocs_insert_text, and googledocs_replace_text. Deny googledocs_create_document and googledocs_delete_content. This lets the agent edit existing documents without creating new ones or deleting content ranges.
Safe find-and-replace#
Enable only googledocs_get_document and googledocs_replace_text. Apply a keyword_block guardrail to googledocs_replace_text on the replacement field to prevent the AI from inserting sensitive content.
Troubleshooting#
- Batch update fails with invalid range — Index positions in
googledocs_batch_updatemust stay within the current document length. Re-fetch the document withgoogledocs_get_documentto get updated positions before applying another batch update. - Replace text finds no matches —
googledocs_replace_textperforms an exact string match by default. Check for extra whitespace or smart quotes that may differ from the search term. - Document not listed —
googledocs_list_documentsuses the Drive API and only returns documents where the connected account has at least viewer access.