# write_doc_structured (https://sellersheetai.com/docs/mcp-api/tools/write_doc_structured)

> Build a document from a list of semantic blocks in ONE call.

Access: **DESTRUCTIVE** · toolset google_workspace · family null

Use it to write a whole document or append a new section: blocks are appended at the end of the body in order (clearFirst=true replaces the body first). For edits inside existing text use the index-based doc tools.

## Call it

MCP tool call:

```json
{
  "name": "write_doc_structured",
  "arguments": {
    "documentId": "<documentId>",
    "blocks": []
  }
}
```

Tool API (early access — contact us):

```bash
curl -X POST https://api.sellersheetai.com/api/v1/tools/write_doc_structured \
  -H "Authorization: Bearer $SELLERSHEET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"documentId":"<documentId>","blocks":[]}'
```

## Arguments

| Name | Type | Required | Description |
|---|---|---|---|
| `documentId` | string | yes | the Google Docs document ID. |
| `blocks` | object[] | yes | Ordered list of block dicts. |
| `clearFirst` | boolean |  | If True, clear existing body before writing. |

## Result

- { blocksWritten: N }

## Gotchas

- Each block is a separate write: an unknown type or a bad block fails the call (400) after the earlier blocks are already in the document — fix it and re-run with clearFirst=true. Block types and shapes: {"type": "title", "text": str} {"type": "subtitle", "text": str} {"type": "heading", "level": 1..6, "text": str, "alignment"?: "START"|"CENTER"|"END"|"JUSTIFIED"} {"type": "paragraph", "text": str, "bold"?: bool, "italic"?: bool, "underline"?: bool, "fontSize"?: float, "fontFamily"?: str, "foregroundColor"?: [r,g,b], "backgroundColor"?: [r,g,b], "alignment"?: str, "linkUrl"?: str} {"type": "bullets", "items": [str, ...], "preset"?: "BULLET_DISC_CIRCLE_SQUARE"} {"type": "numbered", "items": [str, ...], "preset"?: "NUMBERED_DECIMAL_ALPHA_ROMAN"} {"type": "table", "rows": int, "columns": int, "cells"?: [["A1","B1"], ["A2","B2"], ...]} {"type": "image", "uri": str, "widthPt"?: float, "heightPt"?: float} (size applies only when both are given) {"type": "page_break"} {"type": "section_break", "sectionType"?: "NEXT_PAGE"|"CONTINUOUS"} {"type": "horizontal_rule"} {"type": "quote", "text": str} {"type": "spacer"}

## Example

- write_doc_structured(documentId=doc_id, clearFirst=True, blocks=[ {"type": "title", "text": "Q1 Brand Audit"}, {"type": "subtitle", "text": "SellerSheet — April 2026"}, {"type": "horizontal_rule"}, {"type": "heading", "level": 1, "text": "Executive Summary"}, {"type": "paragraph", "text": "Revenue grew 24% YoY..."}, {"type": "heading", "level": 2, "text": "Key Findings"}, {"type": "bullets", "items": [ "A+ content live on 82% of ASINs", "CTR up 18% after title rewrite", "Inventory cover: 45 days", ]}, {"type": "page_break"}, {"type": "heading", "level": 1, "text": "Data"}, {"type": "table", "rows": 3, "columns": 3, "cells": [ ["Metric", "Q4", "Q1"], ["Revenue", "$420k", "$521k"], ["CTR", "0.72%", "0.85%"], ]}, {"type": "quote", "text": "Numbers tell the story, design tells the truth."}, ])