gdocs-mcp
v1.0.0Treat a Google Doc like a local file: content editing, tracked-changes review, comments, tables.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_accounts List authorized Google accounts
List the Google accounts that have been authorized for this server.
set_project_default Set this project’s default account/folder
Write this project’s defaults to a .gdocs-mcp.json in the current working directory (or update an existing one up the tree). Set a default account and/or a default folder (URL or id). The folder is where write_doc is told new docs go: a new doc given as a bare name or at the top of My Drive is refused once, naming the folder and the full path to call. It is read when the server starts, so write_doc’s description shows a change after a restart; the refusal reads it fresh. To set a folder by name, find it first with drive({ cmd: 'find' }) and pass its id.
| Parameter | Type | Description |
|---|---|---|
account | string | default Google account email (must be authorized) |
folder | string | default Drive folder (URL or id): where write_doc says a bare-named new doc will go |
get_project_config Show this project’s gdocs defaults
Show the effective .gdocs-mcp.json defaults (account/folder) for the current working directory, and where the file is.
read_doc Read a Google Doc
Read a Google Doc as markdown + inline HTML. The read opens with a <style> block — one CSS rule per named style (p = Normal text, h1–h6, .title, .subtitle), in pt — and a paragraph or run shows style="…" only where it differs from its rule (text-align, line-height, margin-top/bottom/left/right, text-indent; a hanging indent is margin-left:36pt with a negative text-indent). Title and Subtitle paragraphs read as <p class="title">. A page break reads as <div style="page-break-after:always"></div> on its own line, where the break is. Every element in a paragraph reads, so an edit that quot…
| Parameter | Type | Description |
|---|---|---|
path * | string | The doc or tab: a Drive id or URL, /folder/doc, or /folder/doc/tab (nested: /folder/doc/tab/child). A doc with one tab needs no tab step; a doc with several is refused until one is named, and the refu… |
account | string | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. |
mode | string | read mode (default clean) |
page | string | which header/footer, when a doc defines more than one (default-page, first-page, even-page). Omit to use whichever exists. |
segment | string | content tree to read (default body) |
edit_doc Edit a Google Doc
Replace an exact unique snippet of text in a Google Doc (like a local file Edit). old_string is matched markup-tolerantly; ambiguous matches return surrounding context to disambiguate; a table is matched as its rows, in the form read_doc shows it (a pipe table, or the HTML <table> of a styled one). Elements read_doc shows are kept when old_string and new_string both hold them as read (a person chip inside a sentence you reword survives), deleted when new_string leaves them out, and created when new_string adds one: [^label] with a [^label]: note line, <time datetime="2026-11-15">Nov 15, 2026</…
| Parameter | Type | Description |
|---|---|---|
old_string * | string | exact text to replace (quote a unique slice from read_doc) |
path * | string | The doc or tab: a Drive id or URL, /folder/doc, or /folder/doc/tab (nested: /folder/doc/tab/child). A doc with one tab needs no tab step; a doc with several is refused until one is named, and the refu… |
account | string | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. |
baseDir | string | absolute dir to resolve relative local image paths and contentFile against |
confirmLoss | string | the confirmLoss string from the refusal of a table edit that moves a row or column whose text comments quote, passed back exactly, after the user has agreed that those comments are lost. Never needed… |
contentFile | string | path to a local markdown/text file to use as new_string, read directly by the server — preferred for long text. Absolute, or relative to baseDir. Mutually exclusive with new_string. |
new_string | string | replacement markdown (or use contentFile) |
page | string | which header/footer, when a doc defines more than one (default-page, first-page, even-page). Omit to use whichever exists. |
replace_all | boolean | replace every occurrence (default false) |
segment | string | which content tree to target: body (default), or the page header/footer. Header/footer content is invisible to a body read — a letterhead logo lives there. |
suggest | boolean | send the edit as suggestions for a person to accept or reject, instead of applying it (default false) |
get_page_setup Read document page setup
Read a doc’s (or tab’s) page setup — margins, page size (in points, plus a preset name if it matches letter/legal/a4/tabloid), and orientation. The read counterpart to set_page_setup; use it to mirror another document’s layout onto a new doc.
| Parameter | Type | Description |
|---|---|---|
path * | string | The doc or tab: a Drive id or URL, /folder/doc, or /folder/doc/tab (nested: /folder/doc/tab/child). A doc with one tab needs no tab step; a doc with several is refused until one is named, and the refu… |
account | string | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. |
set_page_setup Set document page setup
Set document-level page setup for a doc (or tab): page margins, page size, and orientation — the File > Page setup controls. Margins and explicit page sizes are in points (72 pt = 1 inch). pageSize is a preset (letter/legal/a4/tabloid) or an explicit {width,height} in points; orientation (portrait/landscape) swaps the page dimensions. Always a direct change: page geometry is a document-style change, so there is no suggest option.
| Parameter | Type | Description |
|---|---|---|
path * | string | The doc or tab: a Drive id or URL, /folder/doc, or /folder/doc/tab (nested: /folder/doc/tab/child). A doc with one tab needs no tab step; a doc with several is refused until one is named, and the refu… |
account | string | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. |
marginBottom | number | bottom margin in points |
marginLeft | number | left margin in points |
marginRight | number | right margin in points |
marginTop | number | top margin in points (72 = 1 inch) |
orientation | string | portrait or landscape (orders the page width/height) |
pageSize | a preset name, or {width,height} in points |
download_images Download a doc’s images
Download every embedded image in a Google Doc to a local folder. Returns the objectId→filename mapping, which correlates with read_doc’s `<img src="image:<objectId>">` markers so you can rewrite them to local paths (the inverse of publishing).
| Parameter | Type | Description |
|---|---|---|
dir * | string | absolute local folder to save images into (created if missing) |
path * | string | The doc or tab: a Drive id or URL, /folder/doc, or /folder/doc/tab (nested: /folder/doc/tab/child). A doc with one tab needs no tab step; a doc with several is refused until one is named, and the refu… |
account | string | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. |
list_suggestions List suggestions in a doc
List the pending suggestions (tracked changes) in a Google Doc, in document order. Each has an `id`, a `summary` (Docs’ own words for it, as in the Docs sidebar, e.g. Replace: “30” with “45”), a `context` (the change in its sentence, [deleted→inserted], so two suggestions with the same summary can be told apart), and its author and time. Returns the doc `title`. Pass the title as expectTitle and each context as expectContext to apply_suggestions. segment: "header" or "footer" lists that one’s suggestions.
| Parameter | Type | Description |
|---|---|---|
path * | string | The doc or tab: a Drive id or URL, /folder/doc, or /folder/doc/tab (nested: /folder/doc/tab/child). A doc with one tab needs no tab step; a doc with several is refused until one is named, and the refu… |
account | string | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. |
page | string | which header/footer, when a doc defines more than one (default-page, first-page, even-page). Omit to use whichever exists. |
segment | string | which content tree to target: body (default), or the page header/footer. Header/footer content is invisible to a body read — a letterhead logo lives there. |
apply_suggestions Accept/reject one or more suggestions
Accept or reject pending suggestions (from list_suggestions) in one update. Each one is resolved on its own, exactly as clicking the check or the cross in Docs: accept keeps the proposed change, reject restores the original. Two suggestions that touch each other (by different people) are decided one at a time, and the text comes out as Docs makes it; to decide them together, pass both. A style-only suggestion resolves like any other. expectTitle is checked against the live document first (status "wrong_doc" on a mismatch, e.g. an id from a different, similarly-titled document), and each expect…
| Parameter | Type | Description |
|---|---|---|
expectTitle * | string | the document’s title, from list_suggestions; checked before anything is changed |
path * | string | The doc or tab: a Drive id or URL, /folder/doc, or /folder/doc/tab (nested: /folder/doc/tab/child). A doc with one tab needs no tab step; a doc with several is refused until one is named, and the refu… |
resolutions * | array | one entry per suggestion to resolve |
account | string | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. |
page | string | which header/footer, when a doc defines more than one (default-page, first-page, even-page). Omit to use whichever exists. |
segment | string | which content tree to target: body (default), or the page header/footer. Header/footer content is invisible to a body read — a letterhead logo lives there. |
list_comments List comments on a doc
List the comments on a Google Doc, each with the text it is on (`quotedText`), the sentence around it (`context`, the text in ⟦⟧), its author (a display name, never an email) and time, whether it is open or resolved, its body and its replies. A comment with a `range` is on that part of the doc, in the body or in a header or footer, and moves with its text; a comment with none was made in Drive and has only its quoted text. Pass a comment’s `id` as replyTo to add_comment, and its `quotedText` as expectQuotedText to resolve_comment.
| Parameter | Type | Description |
|---|---|---|
path * | string | The doc: a Drive id or URL, or /folder/doc. A tab path names its doc. |
account | string | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. |
add_comment Add a comment or reply
Comment on text in a Google Doc: `quotedText` is the text the comment sits on, found the way edit_doc finds old_string (markup-tolerant; text that matches more than once is refused with the context of each match, so quote more of it). The comment stays on that text as it moves. Docs has no comment on the whole doc, so quotedText is required; put overall feedback on the title, or on its first words. The tab comes from path, and segment: "header" or "footer" comments in the page header or footer. To reply to an existing comment instead, pass replyTo (a comment id from list_comments) and no quote…
| Parameter | Type | Description |
|---|---|---|
content * | string | the comment, or the reply |
path * | string | The doc or tab: a Drive id or URL, /folder/doc, or /folder/doc/tab (nested: /folder/doc/tab/child). A doc with one tab needs no tab step; a doc with several is refused until one is named, and the refu… |
account | string | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. |
page | string | which header/footer, when a doc defines more than one (default-page, first-page, even-page). Omit to use whichever exists. |
quotedText | string | the text to comment on; required unless replyTo is given |
replyTo | string | a comment id (from list_comments) to reply to; omit to start a new comment |
segment | string | which content tree to target: body (default), or the page header/footer. Header/footer content is invisible to a body read — a letterhead logo lives there. |
resolve_comment Resolve or reopen a comment
Resolve (or reopen) a comment thread by comment id. expectQuotedText is REQUIRED: the `quotedText` list_comments gave for that comment, exactly. It is checked against the live comment first, so a stale or wrong id is refused instead of resolving the wrong thread.
| Parameter | Type | Description |
|---|---|---|
commentId * | string | |
expectQuotedText * | string | the comment’s quotedText from list_comments; verified before the comment is changed |
path * | string | The doc: a Drive id or URL, or /folder/doc. A tab path names its doc. |
account | string | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. |
reopen | boolean | reopen instead of resolve |
export_doc Export a doc to a file
Export a Google Doc to a real file on disk — pdf (default), docx, odt, rtf, txt, html, epub, or md. Google renders it server-side (File > Download in the UI), so page setup, pagination and layout match the editor. A doc path exports every tab; a tab path (/folder/doc/tab) exports only that tab, through an endpoint Google does not document and rate-limits — if it fails the call is refused and says so, it never falls back to the whole doc. Returns the local path and byte size. Note: Drive refuses to export files larger than 10 MB.
| Parameter | Type | Description |
|---|---|---|
dir * | string | absolute local folder to save the export into (created if missing) |
path * | string | The doc: a Drive id or URL, or /folder/doc. A tab path names its doc. |
account | string | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. |
filename | string | override the filename (default: the doc’s title + extension) |
format | string | default pdf |
write_doc Write a doc or a tab
Write markdown-rendered content to a path, like the local Write tool. A path that names nothing is CREATED and never asks, but only an absolute path (or a Drive id or URL start) creates: a bare name like Contract is refused with the full path to call. When the project has a default folder for new docs, a new doc at the top of My Drive (/Contract) is refused once too, with the default folder’s full path to call, so the user is told where it goes first; the same call repeated goes through: /Work/Contract creates a doc in the folder /Work, /Work/Contract/Notes a tab in that doc, /Work/Contract/…
| Parameter | Type | Description |
|---|---|---|
path * | string | The doc or tab to write: /folder/doc, /folder/doc/tab, /folder/doc/tab/child, or a doc id or URL followed by tab steps. A path that does not exist yet is created (only its last step may be new). |
account | string | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. |
baseDir | string | absolute dir to resolve relative local image paths against (e.g. the markdown file’s folder) |
confirmLoss | string | the confirmLoss string from the refusal, passed back exactly, after the user has agreed to what it lists. Never needed when creating, or with suggest. |
content | string | markdown content (or use contentFile) |
contentFile | string | path to a local markdown/text file to use as the body, read directly by the server — preferred for long documents so the body is passed through mechanically rather than retyped inline (which can sil… |
page | string | which header/footer, when a doc defines more than one (default-page, first-page, even-page). Omit to use whichever exists. |
segment | string | which content tree to target: body (default), or the page header/footer. Header/footer content is invisible to a body read — a letterhead logo lives there. |
suggest | boolean | send the replace as suggestions for a person to accept or reject, instead of applying it (default false) |
drive Drive as a filesystem
Navigate and reorganise Google Drive with shell commands: ls, find, mkdir, cp, mv. Arguments are positional and follow the usual shell forms. ls [path] — list a folder (default My Drive root). find <text> [-type d|f] — search everything by name, including files no path can reach. mkdir [-p] <path> — create a folder. cp <src> <dst> — duplicate a file (preserves headers/footers, image sizing and exact formatting, which a markdown round-trip cannot rebuild). mv <src> <dst> — move and/or rename, as on a filesystem: an existing folder as <dst> means "into it", anything else means "to that…
| Parameter | Type | Description |
|---|---|---|
cmd * | string | |
acceptOwnershipTransfer | boolean | mv only: required to move into /shared/… , which hands ownership to that drive's organisation and cannot be undone |
account | string | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. |
args | array | positional arguments for cmd, e.g. ["/Work/Roof", "/Archive"] for mv |
expectName | string | mv only: the name the source is expected to have; the move is refused if it resolved to something else |
index | integer | mv of a tab only: its position among its new siblings, 0 first. Without it a tab keeps its place, or goes first when nested. |
list_permissions List who a doc is shared with
List the permissions on a Google Doc (people, groups, domain, anyone-with-link) with their roles. Each entry carries a `subject` naming who it covers — an email, "<domain> (domain)", or "anyone with the link" — since a domain or link grant has no email. For those, `allowFileDiscovery: true` means the file also surfaces in that audience's search, not merely that it opens with the link. Note a doc created under a Workspace domain may already carry a domain grant before you share it.
| Parameter | Type | Description |
|---|---|---|
path * | string | The doc: a Drive id or URL, or /folder/doc. A tab path names its doc. |
account | string | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. |