Tool: update_doc
Updates a document using batch update requests. It accepts a documents.batchUpdate request (as JSON).
Corresponds to documents.batchUpdate in the REST API.
The list of possible updates is:
replaceAllText: Replaces all instances of the specified text.insertText: Inserts text at the specified location.updateTextStyle: Updates the text style at the specified range.createParagraphBullets: Creates bullets for paragraphs.deleteParagraphBullets: Deletes bullets from paragraphs.createNamedRange: Creates a named range.deleteNamedRange: Deletes a named range.updateParagraphStyle: Updates the paragraph style at the specified range.deleteContentRange: Deletes content from the document.insertInlineImage: Inserts an inline image at the specified location.insertTable: Inserts a table at the specified location.insertTableRow: Inserts an empty row into a table.insertTableColumn: Inserts an empty column into a table.deleteTableRow: Deletes a row from a table.deleteTableColumn: Deletes a column from a table.insertPageBreak: Inserts a page break at the specified location.deletePositionedObject: Deletes a positioned object from the document.updateTableColumnProperties: Updates the properties of columns in a table.updateTableCellStyle: Updates the style of table cells.updateTableRowStyle: Updates the row style in a table.replaceImage: Replaces an image in the document.updateDocumentStyle: Updates the style of the document.insertInlineSheetsChart: Inserts an inline Google Sheets chart at the specified location.mergeTableCells: Merges cells in a table.unmergeTableCells: Unmerges cells in a table.refreshSheetsChart: Refreshes a Google Sheets chart.createHeader: Creates a header.createFooter: Creates a footer.createFootnote: Creates a footnote.replaceNamedRangeContent: Replaces the content in a named range.updateEmbeddedObject: Updates the properties of an embedded object.updateSectionStyle: Updates the section style of the specified range.insertSectionBreak: Inserts a section break at the specified location.deleteHeader: Deletes a header from the document.deleteFooter: Deletes a footer from the document.pinTableHeaderRows: Updates the number of pinned header rows in a table.addDocumentTab: Adds a document tab.deleteTab: Deletes a document tab.updateDocumentTabProperties: Updates the properties of a document tab.insertPerson: Inserts a person mention.updateNamedStyle: Updates a named style.insertRichLink: Insert a rich link.insertDate: Inserts a date.insertComment: Inserts a CommentThread into the document.addCommentReply: Adds a reply to a CommentThread or SuggestionThread.updateCommentPost: Updates an existing post (head post or reply) of a CommentThread or SuggestionThread.deleteComment: Deletes a CommentThread.deleteCommentReply: Deletes a reply Post from a CommentThread or SuggestionThread.acceptSuggestion: Accepts a suggestion.rejectSuggestion: Rejects a suggestion.deleteSuggestion: Deletes a suggestion.
The following sample demonstrate how to use curl to invoke the update_doc MCP tool.
| Curl Request |
|---|
curl --location 'https://docsmcp.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "update_doc", "arguments": { // provide these details according to the tool MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
UpdateDocRequest
| JSON representation |
|---|
{ "documentId": string, "requests": [ { object } ] } |
| Fields | |
|---|---|
documentId |
Required. The ID of the document to update. This is the same as file_id from Drive tools. |
requests[] |
A list of updates to apply to the document. Each request should be a valid documents.batchUpdate Request object, using the schema documented in: https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request Requests will be applied in the order they are specified. If any request is not valid, no requests will be applied. |
Struct
| JSON representation |
|---|
{ "fields": { string: value, ... } } |
| Fields | |
|---|---|
fields |
Unordered map of dynamically typed values. An object containing a list of |
FieldsEntry
| JSON representation |
|---|
{ "key": string, "value": value } |
| Fields | |
|---|---|
key |
|
value |
|
Value
| JSON representation |
|---|
{ "nullValue": null, "numberValue": number, "stringValue": string, "boolValue": boolean, "structValue": { object }, "listValue": array } |
| Fields | |
|---|---|
Union field kind. The kind of value. kind can be only one of the following: |
|
nullValue |
Represents a JSON |
numberValue |
Represents a JSON number. Must not be |
stringValue |
Represents a JSON string. |
boolValue |
Represents a JSON boolean ( |
structValue |
Represents a JSON object. |
listValue |
Represents a JSON array. |
ListValue
| JSON representation |
|---|
{ "values": [ value ] } |
| Fields | |
|---|---|
values[] |
Repeated field of dynamically typed values. |
NullValue
Represents a JSON null.
NullValue is a sentinel, using an enum with only one value to represent the null value for the Value type union.
A field of type NullValue with any value other than 0 is considered invalid. Most ProtoJSON serializers will emit a Value with a null_value set as a JSON null regardless of the integer value, and so will round trip to a 0 value.
| Enums | |
|---|---|
NULL_VALUE |
Null value. |
Output Schema
UpdateDocResponse
| JSON representation |
|---|
{ "replies": [ { object } ] } |
| Fields | |
|---|---|
replies[] |
The replies from executing the batch update requests. Includes errors, warnings, and raw API responses to help the model make adjustments. The raw API responses use the schema documented in: https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/response |
Struct
| JSON representation |
|---|
{ "fields": { string: value, ... } } |
| Fields | |
|---|---|
fields |
Unordered map of dynamically typed values. An object containing a list of |
FieldsEntry
| JSON representation |
|---|
{ "key": string, "value": value } |
| Fields | |
|---|---|
key |
|
value |
|
Value
| JSON representation |
|---|
{ "nullValue": null, "numberValue": number, "stringValue": string, "boolValue": boolean, "structValue": { object }, "listValue": array } |
| Fields | |
|---|---|
Union field kind. The kind of value. kind can be only one of the following: |
|
nullValue |
Represents a JSON |
numberValue |
Represents a JSON number. Must not be |
stringValue |
Represents a JSON string. |
boolValue |
Represents a JSON boolean ( |
structValue |
Represents a JSON object. |
listValue |
Represents a JSON array. |
ListValue
| JSON representation |
|---|
{ "values": [ value ] } |
| Fields | |
|---|---|
values[] |
Repeated field of dynamically typed values. |
NullValue
Represents a JSON null.
NullValue is a sentinel, using an enum with only one value to represent the null value for the Value type union.
A field of type NullValue with any value other than 0 is considered invalid. Most ProtoJSON serializers will emit a Value with a null_value set as a JSON null regardless of the integer value, and so will round trip to a 0 value.
| Enums | |
|---|---|
NULL_VALUE |
Null value. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ❌ | Read Only Hint: ❌ | Open World Hint: ✅