insert_doc_text
Insert text at one or more positions in a Google Doc, including headers or footers, using indices from the document structure to place content accurately.
Instructions
Insert text at one or more positions in a Google Doc.
All indices are interpreted as positions in the document before any of the insertions in this call. Insertions are applied high-index-first so earlier indices are not shifted by later ones.
Use get_doc_structure to obtain the correct target indices.
Args: doc_id: The Google Doc file ID. insertions: List of insertion dicts. Required keys: index (int): document position to insert at. text (str): text to insert. "\n" creates a new paragraph. Optional keys: segment_id (str): segmentId of the header or footer to insert into (the headerId / footerId returned by create_header / create_footer). Omit to insert into the document body.
Returns: Confirmation with docId and count of insertions applied.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"doc_id": "<doc_id>",
"insertions": "<insertions>"
},
"name": "insert_doc_text"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc_id | Yes | ||
| insertions | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||