Create, edit, and manage Google Docs documents through AI agents. Read document content, insert and replace text, format paragraphs, headings and tables, manage document structure, and collaborate on Google Docs programmatically.
OpenClaw is a self-hosted agent gateway. It connects to remote MCP servers over streamable HTTP, configured in one file.
This guide connects Google Docs to OpenClaw through MewCP, so OpenClaw can use Google Docs's 31 tools, like get_document, get_document_text and create_document, without your Google Docs credentials ever reaching the app.
Google Docs signs in through managed OAuth. MewCP stores the token encrypted, refreshes it before it expires and injects it only at call time. Your agent never holds it, so it can never leak it.
More apps
Search a connected Notion workspace and read any page, database or saved view. Create and update pages, create databases, and query data sources with SQL or structured filters. Also covers comments and discussions, moving and duplicating pages, file uploads, workspace users and teamspaces, and Notion Skills and Agents.
Manage Google Drive files directly through your AI workflows. Search documents using advanced queries, browse folders, read file content, and upload, download, or delete files with ease.
Create and manage Lucid diagrams with AI agents, including flowcharts, process maps, architecture diagrams, and visual documentation. Search existing Lucid content and update diagrams using natural language.
Connect AI agents to ClickUp to manage tasks, projects, documents, lists, comments, and workflows, while searching workspace data and automating project management activities.
Other clients
Google Docs works the same way in every client below. Pick yours for its own guide.
Free to start.
Scope access to the exact Google Docs tools and accounts you allow, work and personal side by side. Anything outside that scope is refused at call time, even when the model asks for it.
Each call is logged: what ran, on which account, and whether it worked. Failures come back structured, so the agent knows whether to retry instead of guessing.
Every app sits behind one secure MCP URL, and there is no server for you to deploy or keep running. Add an integration in the dashboard and it is live on the next call, with no config to change and no new credentials to wire up. Tools load only when a task needs them, so your agent stays fast and focused however many apps you connect.
Edit ~/.openclaw/openclaw.json. Create it if it doesn't exist.
Restart OpenClaw. Sign in when the browser window opens.
Start a new chat and ask: "List the tools you can use from MewCP." You should see your connected apps.
Gets the latest version of a Google Docs document and returns the full structural JSON: documentId, title, revisionId, and every tab (child tabs nested under `childTabs`) with its body content, element start/end indexes, styles, headers, footers, inline objects and lists. Comment and suggestion threads are included only with comments_view_mode COMMENTS_VIEW_MODE_INCLUDED, which needs suggestions_view_mode SUGGESTIONS_INLINE. The output is large; use get_document_text to locate edit positions. The document ID is the Drive file ID; the Docs API has no list or search, so find IDs with Drive tools.
Returns a compact text rendering of a Google Docs document for locating edit positions, instead of the full structural JSON: per tab (child tabs listed right after their parent), every paragraph's text with its UTF-16 startIndex/endIndex, named style, list ID and, inside tables, the table start index and row/column; plus each table's start index, size and merged cells, and header/footer text with their IDs. Non-text elements (images, page breaks, smart chips) appear as U+FFFC characters so startIndex plus the offset in `text` is the document index. Also returns revisionId to pass as required_revision_id on edits. Indexes differ between suggestion view modes, so read in the mode the edits will target. The document ID is the Drive file ID; the Docs API has no list or search, so find IDs with Drive tools.
Creates a blank Google Docs document with the given title and returns only its documentId, title, revisionId and tabs (tabId, title, index); the new body is one empty paragraph, so insert at index 1 or use at_end. Only the title is set; add content afterwards with the edit tools using the returned documentId.
DESTRUCTIVE — REQUIRES EXPLICIT USER CONFIRMATION BEFORE CALLING. Applies a list of raw Docs API batchUpdate requests to a document in one atomic call; the requests can delete or overwrite any content, tabs, headers, footers, comments or styles. Every request is validated first: if any is invalid the whole batch fails and nothing is applied. Removed or overwritten content is not returned and cannot be restored through this server, only by hand from the document's version history. Returns documentId, replies (one per request, in order), writeControl, suggestionResponses and commentUpdateState. Use the single-request tools for one edit; use this for several edits that must land together or for request types without their own tool (named ranges, section breaks, footnotes, smart chips, dropdowns, positioned objects). Order requests by descending index so earlier edits do not shift later indexes. With write_mode SUGGEST the batch fails if it contains addDocumentTab, createNamedRange, deleteFooter, deleteHeader, deleteNamedRange, deleteTab, updateDocumentTabProperties or updateTableColumnProperties. Writes are limited to 60 per minute per user (429 when exceeded). NEVER call this tool autonomously or as part of an automated flow. You MUST stop, tell the user exactly what the requests will change or delete and that it cannot be undone through this server, and wait for their explicit written confirmation before proceeding.
Inserts text at a UTF-16 index, or at the end of the body, a header, footer or footnote with at_end, and returns the batch update reply (documentId, writeControl, replies, suggestionResponses). Text must go inside an existing paragraph, so it cannot be inserted at a table's start index. A newline starts a new paragraph that copies the current paragraph's style, including bullets; control characters U+0000-U+0008 and U+000C-U+001F and private-use characters U+E000-U+F8FF are stripped. Inserting shifts the indexes of everything after it, so for several edits work from the highest index down. NOTE: this changes the document's content at that position. The prior state is not in the response but stays recoverable from the document's version history. Pass required_revision_id (from get_document or get_document_text) to make the edit fail instead of landing on changed content.
DESTRUCTIVE — REQUIRES EXPLICIT USER CONFIRMATION BEFORE CALLING. Permanently deletes the content between start_index and end_index (UTF-16, end exclusive) in a tab's body, header, footer or footnote, and returns the batch update reply. Deleting across a paragraph boundary merges the two paragraphs, which can change paragraph styles, lists, positioned objects and bookmarks. Not allowed: one code unit of a surrogate pair; the last newline of a body, header, footer, footnote, table cell or table of contents; the start or end of a table, table of contents or equation without the whole element; the newline before a table, table of contents or section break without the element; or individual table rows or cells (use delete_table_row / delete_table_column). Content inside a table cell can be deleted. The deleted content is not returned and cannot be restored through this server, only by hand from the document's version history. NEVER call this tool autonomously or as part of an automated flow. You MUST stop, tell the user exactly which text and content in which range will be deleted and that it cannot be undone through this server, and wait for their explicit written confirmation before proceeding.
DESTRUCTIVE — REQUIRES EXPLICIT USER CONFIRMATION BEFORE CALLING. Replaces every match of find_text (substring by default, optionally case-sensitive or a regular expression) with replace_text across all tabs, or only the given tab_ids, and returns occurrencesChanged with the batch update reply. Matches by text, so it needs no prior read of the document. Every match is overwritten in one call; the replaced text is not returned and cannot be restored through this server, only by hand from the document's version history. NEVER call this tool autonomously or as part of an automated flow. You MUST stop, tell the user exactly what text will be replaced, with what, in which tabs, and how matching works (case and regex) and that it cannot be undone through this server, and wait for their explicit written confirmation before proceeding.
Updates the character style (bold, italic, underline, strikethrough, small caps, font size, font family and weight, text and background color, link, superscript/subscript) of a UTF-16 index range and returns the batch update reply. Only the style params you set are changed; others keep their current value. If the range fully contains a list paragraph, its bullet gets the same style. Clearing a style back to its default is not supported here; use batch_update_document. NOTE: this overwrites the set style properties on the range. The prior state is not in the response but stays recoverable from the document's version history. Pass required_revision_id (from get_document or get_document_text) to make the edit fail instead of landing on changed content.
Updates the paragraph style (named style such as HEADING_1, alignment, line spacing, space above/below, indents, direction, keep-with-next, keep-lines-together, page break before, shading) of every paragraph the UTF-16 index range overlaps, and returns the batch update reply. Only the style params you set are changed; the named style is applied before the other properties. The range may extend to adjacent newlines. Borders and other paragraph style fields are reachable through batch_update_document. NOTE: this overwrites the set style properties on those paragraphs. The prior state is not in the response but stays recoverable from the document's version history. Pass required_revision_id (from get_document or get_document_text) to make the edit fail instead of landing on changed content.
Turns every paragraph the UTF-16 index range overlaps into a bulleted or numbered list item using a bullet preset, and returns the batch update reply. Each paragraph's nesting level comes from its leading tab characters, which are removed (shifting later indexes). Paragraphs are joined to a matching list immediately before them. NOTE: this overwrites the list formatting of those paragraphs. The prior state is not in the response but stays recoverable from the document's version history. Pass required_revision_id (from get_document or get_document_text) to make the edit fail instead of landing on changed content.
Inserts a page break followed by a newline at a UTF-16 index, or at the end of the body with at_end, and returns the batch update reply. Page breaks go only in the document body, inside an existing paragraph: not at a table's start index, and not inside a table, equation, footnote, header or footer. NOTE: this changes the document's content at that position. The prior state is not in the response but stays recoverable from the document's version history. Pass required_revision_id (from get_document or get_document_text) to make the edit fail instead of landing on changed content.
Removes the bullets or numbering from every paragraph the UTF-16 index range overlaps, keeping each paragraph's nesting level as indentation, and returns the batch update reply. The text itself is kept. NOTE: this overwrites the list formatting of those paragraphs. The prior state is not in the response but stays recoverable from the document's version history. Pass required_revision_id (from get_document or get_document_text) to make the edit fail instead of landing on changed content.
Inserts an empty table with the given rows and columns at a UTF-16 index, or at the end of the body, a header or footer with at_end, and returns the batch update reply. With `index`, a newline is inserted before the table, so the new table starts at index + 1; with at_end, it starts at what was the endIndex of the segment's last paragraph. Read `tables[].startIndex` from get_document_text before using the table tools. The table must go inside an existing paragraph (not at another table's start index) and cannot go inside a footnote or equation. NOTE: this changes the document's content at that position. The prior state is not in the response but stays recoverable from the document's version history. Pass required_revision_id (from get_document or get_document_text) to make the edit fail instead of landing on changed content.
Inserts an empty row above or below the row of a reference cell (above or below the whole merged cell if it is merged) in the table starting at table_start_index, and returns the batch update reply. NOTE: this changes the table's structure and shifts later indexes. The prior state is not in the response but stays recoverable from the document's version history. Pass required_revision_id (from get_document or get_document_text) to make the edit fail instead of landing on changed content.
DESTRUCTIVE — REQUIRES EXPLICIT USER CONFIRMATION BEFORE CALLING. Permanently deletes the row a reference cell spans, with all its content, from the table starting at table_start_index, and returns the batch update reply. If the cell is merged across several rows, all of those rows are deleted; if no rows remain, the whole table is deleted. The deleted content is not returned and cannot be restored through this server, only by hand from the document's version history. NEVER call this tool autonomously or as part of an automated flow. You MUST stop, tell the user exactly which table row and its content will be deleted and that it cannot be undone through this server, and wait for their explicit written confirmation before proceeding.
Inserts an empty column to the left or right of the column of a reference cell (of the whole merged cell if it is merged) in the table starting at table_start_index, and returns the batch update reply. NOTE: this changes the table's structure and shifts later indexes. The prior state is not in the response but stays recoverable from the document's version history. Pass required_revision_id (from get_document or get_document_text) to make the edit fail instead of landing on changed content.
DESTRUCTIVE — REQUIRES EXPLICIT USER CONFIRMATION BEFORE CALLING. Permanently deletes the column a reference cell spans, with all its content, from the table starting at table_start_index, and returns the batch update reply. If the cell is merged across several columns, all of those columns are deleted; if no columns remain, the whole table is deleted. The deleted content is not returned and cannot be restored through this server, only by hand from the document's version history. NEVER call this tool autonomously or as part of an automated flow. You MUST stop, tell the user exactly which table column and its content will be deleted and that it cannot be undone through this server, and wait for their explicit written confirmation before proceeding.
Merges a range of cells (starting cell plus row and column span) in the table starting at table_start_index into one cell, and returns the batch update reply. Text from the merged cells is concatenated into the head cell (upper-left for left-to-right content, upper-right otherwise). A non-rectangular range, which can happen with already-merged cells or non-rectangular tables, fails with 400. NOTE: this overwrites the cell layout of that range. The prior state is not in the response but stays recoverable from the document's version history. Pass required_revision_id (from get_document or get_document_text) to make the edit fail instead of landing on changed content.
Updates the style (background color, content alignment, padding, border color, width and dash style) of a range of table cells, or of every cell when row_span and column_span are both omitted, and returns the batch update reply. Only the style params you set are changed; padding and border settings apply to all four sides. A border is always replaced whole, so border_color and border_width_pt must be set together (border_dash_style defaults to SOLID). A border shared with an adjacent cell is updated on that cell too. NOTE: this overwrites the set style properties on those cells. The prior state is not in the response but stays recoverable from the document's version history. Pass required_revision_id (from get_document or get_document_text) to make the edit fail instead of landing on changed content.
Inserts an image from a public URL as an inline object at a UTF-16 index, or at the end of the body, a header or footer with at_end, and returns the new objectId with the batch update reply. The image is fetched once and a copy is stored in the document. It must be PNG, JPEG or GIF, under 50 MB and at most 25 megapixels, and the URL must be publicly accessible and at most 2 KB long. The image must go inside an existing paragraph and cannot go inside a footnote or equation. NOTE: this changes the document's content at that position. The prior state is not in the response but stays recoverable from the document's version history. Pass required_revision_id (from get_document or get_document_text) to make the edit fail instead of landing on changed content.
Creates an empty default header and applies it to the section that begins at the given section break, or to the whole document style when no section break (or the first one) is given, and returns the new headerId. Fails with 400 if that section or document already has a default header. Write into it with insert_text using segment_id = headerId and at_end = true.
Creates an empty default footer and applies it to the section after the given section break, or to the whole document style when no section break (or the first one) is given, and returns the new footerId. Fails with 400 if that section or document already has a default footer. Write into it with insert_text using segment_id = footerId and at_end = true.
Adds a new empty tab to a document, at the given position among its siblings (later tabs shift up by one) and optionally nested under a parent tab, and returns the new tab's properties (tabId, title, index, parentTabId, nestingLevel). All properties are optional. Tab changes are applied as normal edits; they cannot be made as suggestions.
DESTRUCTIVE — REQUIRES EXPLICIT USER CONFIRMATION BEFORE CALLING. Permanently deletes a tab from a document together with all of its child tabs and everything they contain, and returns the batch update reply. The deleted tabs are not returned and cannot be restored through this server, only by hand from the document's version history. NEVER call this tool autonomously or as part of an automated flow. You MUST stop, tell the user exactly which tab and which child tabs will be deleted with their content and that it cannot be undone through this server, and wait for their explicit written confirmation before proceeding.
Updates a document tab's title, position among its siblings, parent tab or emoji icon, and returns the batch update reply. Only the properties you set are changed; others keep their current value. Tab changes are applied as normal edits; they cannot be made as suggestions. NOTE: this overwrites the set tab properties. The prior state is not in the response but stays recoverable from the document's version history.
Adds a new comment thread anchored to a UTF-16 index range of a document, optionally assigned to a user by email, and returns the created thread (commentId, anchorId, headPost.postId, status, plainTextQuote) with the batch update reply. Content is plain text, non-empty and at most 2048 UTF-8 bytes, and behaves like a comment made in the Docs editor (formatting, notifications). Check commentUpdateState: ALL_FAILED_UNKNOWN_REASON means the comment change was not saved.
Adds a reply post to an existing comment thread or suggestion thread, and returns the created post (postId, content, commentAction, author, createTime) with the batch update reply. On a comment thread the reply can also resolve or reopen it (comment_action, no content needed) or reassign it (assignee_email, only when the thread's head post already has an assignee). Content is plain text, at most 2048 UTF-8 bytes, and behaves like a reply made in the Docs editor. Check commentUpdateState: ALL_FAILED_UNKNOWN_REASON means the comment change was not saved.
Replaces the text of one post (head post or reply) in a comment thread or suggestion thread, and returns the batch update reply. Fails with 400 if the requesting user is not the post's author or the post is the head post of a suggestion thread. Content is plain text, non-empty, at most 2048 UTF-8 bytes. Check commentUpdateState: ALL_FAILED_UNKNOWN_REASON means the comment change was not saved. NOTE: this overwrites the post's current text. The prior state is not in the response but stays recoverable from the document's version history.
DESTRUCTIVE — REQUIRES EXPLICIT USER CONFIRMATION BEFORE CALLING. Permanently deletes a comment thread, including its head post and every reply, and returns the batch update reply. Only the author of the thread's head post can delete it; anyone else gets 400. To close a thread without deleting it, use add_comment_reply with comment_action RESOLVE. The deleted thread is not returned and cannot be restored through this server. Check commentUpdateState: ALL_FAILED_UNKNOWN_REASON means the comment change was not saved. NEVER call this tool autonomously or as part of an automated flow. You MUST stop, tell the user exactly which comment thread and how many replies will be deleted and that it cannot be undone through this server, and wait for their explicit written confirmation before proceeding.
Accepts a suggestion, applying the suggested change to the document, and returns the batch update reply with the accepted IDs in suggestionResponses[].acceptedSuggestionIds. Fails with 403 if the requesting user does not have edit access to the document. Check commentUpdateState: the change can commit while the suggestion thread fails to save. NOTE: this overwrites the suggested range with the suggested change. The prior state is not in the response but stays recoverable from the document's version history.
Rejects a suggestion, discarding the suggested change, and returns the batch update reply with the rejected IDs in suggestionResponses[].rejectedSuggestionIds. Fails with 403 if the requesting user has no edit access to the document and is not the suggestion's author. Check commentUpdateState: the change can commit while the suggestion thread fails to save. NOTE: this discards the suggested change. The prior state is not in the response but stays recoverable from the document's version history.