googledocs

Update Document Section Markdown

TOOL
Slug
GOOGLEDOCS_UPDATE_DOCUMENT_SECTION_MARKDOWN
Version
20261008_00
Toolkit
googledocs
Tool to insert or replace a section of a Google Docs document with Markdown content. Use when you need to update only a section of a document by specifying start and optional end indices. Supports full Markdown formatting.
tab_id
STRING
Optional tab ID to update with the rendered Markdown. When omitted, the first tab is updated.
end_index
INTEGER
Optional one-based end index of the content to replace (exclusive); must be greater than or equal to start_index. If end_index is not provided, the content is inserted at the start_index without replacing existing content. Requires start_index to be provided - if start_index is omitted (append mode), end_index is ignored. Important: Use the exact indices from GOOGLEDOCS_GET_DOCUMENT_BY_ID without modification. The Google Docs API does not allow deleting the last newline character of a document segment (body, header, footer, etc.), so ensure end_index does not include the final segment newline.
document_idrequired
STRING
The unique ID of the Google Docs document to update. This is the alphanumeric string found in the document URL: https://docs.google.com/document/d/{DOCUMENT_ID}/edit. Valid IDs are typically 44 characters long and contain only letters, numbers, hyphens, and underscores (e.g., '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms'). To get a document ID: create a new document using GOOGLEDOCS_CREATE_DOCUMENT, or extract it from an existing document's URL. Also accepts parameter aliases: 'id', 'doc_id', 'documentId', or 'docId'.
start_index
INTEGER
One-based UTF-16 code unit index where to insert or start replacement. If not provided, content will be appended to the end of the document. Use 1 to insert at the very beginning of the document. To insert at a specific position, first use GOOGLEDOCS_GET_DOCUMENT_BY_ID to retrieve the document structure and find the desired index from the body.content elements' start_index/end_index values. If the provided index equals or exceeds the document segment's end index, it will be automatically adjusted to the last valid position (end_index - 1) and a message will be included in the response.
markdown_textrequired
STRING
Markdown content to insert or replace in the document section. Large content is automatically split into smaller batches to avoid API limits. Also accepts 'markdown', 'content', 'text', 'body', 'markdownText', or 'markdown_content'.