Docs
Exposes the Google Docs API v1 as agent tools: read a document's text; create
documents; append and replace text; insert inline images and tables; and run
arbitrary batchUpdate requests (styling, named ranges, positioned inserts,
deletes).
What it does
An agent-invocable tool node — no data flows through lanes. Each operation is a
@tool_function an agent calls on demand. Operational targets (documentId)
are always tool-call parameters, never node config. Outputs are cleaned shapes
(documentId, title, revisionId, body_text, replies_count,
occurrencesChanged), not raw API JSON.
Configuration
| Field | Notes |
|---|---|
google.authType | service (service account) or user (OAuth). |
google.serviceKey / google.adminEmail | Service account JSON key; adminEmail enables domain-wide delegation (impersonate that user). |
google.oAuthButton / google.userToken | User OAuth: sign in to populate the access token. |
docs.access | readonly or write (default). Resolved by the shared DOCS spec in core/google_access.py; scopes are never hand-entered. |
Access tiers → scopes
| Tier | Scope | Capability |
|---|---|---|
readonly | documents.readonly | read document text + metadata only |
write | documents | full read/write (default) |
There are no destructive gate flags. Permanent document deletion is a Drive
operation and lives in tool_drive.
Tools
- Read:
document_get— returns{documentId, title, revisionId, body_text}, wherebody_textis the concatenated plain text of the paragraph text runs. Long documents are capped at 50,000 characters and flagged withtruncated: true. Works at thereadonlytier. - Write:
document_create(create a document, optionally seeding initial body text via a follow-upinsertText),batch_update(the catch-all: pass the full DocsbatchUpdaterequest list). - Convenience wrappers (write) over
batch_update, so an agent needn't do index math:text_append— append text at the end of the body (insertTextatendOfSegmentLocation).text_replace— replace all occurrences of a string (replaceAllText);matchCasedefaults tofalse. ReturnsoccurrencesChanged.image_insert— insert an inline image at the end of the body (insertInlineImage); theurimust be a publichttps://URL. Optionalwidth/heightin points (PT).table_insert— insert an emptyrows×columnstable at the end of the body (insertTable);rowsis clamped to 1..1000 andcolumnsto 1..25.
- Diagnostics:
check_connectionprobes the Docs API with a live call; for user OAuth it also verifies that granted scopes cover the configured access tier (service-account auth has no per-user scope grant to check).
The entire Docs v1 surface is documents().get / create / batchUpdate; the
wrappers are conveniences over batch_update.
Setup
Authenticate with either a Google service account (google.serviceKey JSON,
optionally google.adminEmail for domain-wide delegation) or user OAuth
(click sign-in to populate google.userToken). The Google Docs API must be
enabled on the Google Cloud project backing the credential.
Limits
- Export is not a Docs operation. Exporting a document to PDF or
.docxis a Drive export, not a Docs API call — usetool_drive'sfile_export(issue #1056), not this node. document_get'sbody_textis capped at 50,000 characters (truncated: truewhen the document is longer) and covers paragraph text runs only — table cells, headers/footers, and footnotes are not concatenated. For full structure usebatch_updatereads or the raw document.batch_updaterequest bodies follow Google's DocsbatchUpdatelimits.- Rate limits are per Google project; the node retries
429/5xxwith exponential backoff.
Examples
An agent creates a document, appends text, then inserts a table:
document_create { "title": "Weekly Report", "text": "Summary\n" }
text_append { "documentId": "1AbC...", "text": "\nMetrics below:\n" }
table_insert { "documentId": "1AbC...", "rows": 3, "columns": 2 }
Replace a placeholder throughout a template:
text_replace { "documentId": "1AbC...", "containsText": "{{name}}",
"text": "Ada Lovelace", "matchCase": true }
Upstream docs
- Google Docs API v1: https://developers.google.com/docs/api/reference/rest
documents.batchUpdate: https://developers.google.com/docs/api/reference/rest/v1/documents/batchUpdate- Request types (insertText, replaceAllText, insertInlineImage, insertTable): https://developers.google.com/docs/api/reference/rest/v1/documents/request
Troubleshooting
- Scope / 403 errors: call
check_connection; if scopes are missing, disconnect and reconnect the Google account at the required access tier. accessis read-only: write operations raiseGoogleAccessError; raisedocs.accesstowrite.image_insertrejects the URL: theurimust be a publichttps://URL Google can fetch (nothttp://, a data URL, or a private/authenticated link).