MCP Tools Reference: docsmcp.googleapis.com

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

string

Required. The ID of the document to update. This is the same as file_id from Drive tools.

requests[]

object (Struct format)

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

map (key: string, value: value (Value format))

Unordered map of dynamically typed values.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

FieldsEntry

JSON representation
{
  "key": string,
  "value": value
}
Fields
key

string

value

value (Value format)

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

null

Represents a JSON null.

numberValue

number

Represents a JSON number. Must not be NaN, Infinity or -Infinity, since those are not supported in JSON. This also cannot represent large Int64 values, since JSON format generally does not support them in its number type.

stringValue

string

Represents a JSON string.

boolValue

boolean

Represents a JSON boolean (true or false literal in JSON).

structValue

object (Struct format)

Represents a JSON object.

listValue

array (ListValue format)

Represents a JSON array.

ListValue

JSON representation
{
  "values": [
    value
  ]
}
Fields
values[]

value (Value format)

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[]

object (Struct format)

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

map (key: string, value: value (Value format))

Unordered map of dynamically typed values.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

FieldsEntry

JSON representation
{
  "key": string,
  "value": value
}
Fields
key

string

value

value (Value format)

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

null

Represents a JSON null.

numberValue

number

Represents a JSON number. Must not be NaN, Infinity or -Infinity, since those are not supported in JSON. This also cannot represent large Int64 values, since JSON format generally does not support them in its number type.

stringValue

string

Represents a JSON string.

boolValue

boolean

Represents a JSON boolean (true or false literal in JSON).

structValue

object (Struct format)

Represents a JSON object.

listValue

array (ListValue format)

Represents a JSON array.

ListValue

JSON representation
{
  "values": [
    value
  ]
}
Fields
values[]

value (Value format)

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: ✅