addComment
Adds a comment to a Google Docs document at a specified text range, enabling AI agents to programmatically annotate documents and retrieve the comment ID via listComments.
Instructions
Adds a comment to the document at the specified text range. Use listComments to retrieve the comment ID after creation. Note: programmatically created comments appear in the comments panel but may not show as anchored highlights in the document UI.
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": {
"documentId": "<documentId>",
"startIndex": "<startIndex>",
"endIndex": "<endIndex>",
"content": "<content>"
},
"name": "addComment"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | The text content of the comment. | |
| endIndex | Yes | The ending index of the text range (exclusive). | |
| documentId | Yes | The document ID — the long string between /d/ and /edit in a Google Docs URL. | |
| startIndex | Yes | The starting index of the text range (inclusive, starts from 1). |