## Tool: `update_draft`

Updates an existing draft email in the authenticated user's Gmail account. This operation supports merge semantics: fields provided in the request (non-empty) will overwrite the corresponding fields in the draft, while omitted (or empty) fields will preserve their existing values. Plain text body content can be provided in `body` (do NOT format `body` with Markdown), and rich-text HTML content can be provided in `htmlBody` (use valid HTML tags for formatting; if only one is provided, the other is cleared to keep content in sync). WARNING: Attachments are NOT merged. If the draft contains attachments, they will be removed unless they are explicitly re-provided in the `attachments` field of this request.

Returns a Draft object with the `id`, `threadId`, and `viewUrl` fields populated.

The following code sample shows how to use `curl` to call the `update_draft` MCP tool.

| Curl Request |
|---|
| ```bash curl --location 'https://gmailmcp.googleapis.com/mcp/v1' \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "update_draft", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' ``` |

## Input Schema

Request message for UpdateDraft RPC.

### UpdateDraftRequest

| JSON representation |
|---|
| ``` { "draftId": string, "to": [ string ], "cc": [ string ], "bcc": [ string ], "subject": string, "body": string, "htmlBody": string, "attachments": [ { object (`Attachment`) } ] } ``` |

| Fields ||
|---|---|
| `draftId` | `string` Required. The unique identifier of the draft to update. |
| `to[]` | `string` Optional. The primary recipients of the email draft. Each string MUST be a valid plain email address (e.g., "user@example.com"). If omitted or empty, the existing recipients are preserved. |
| `cc[]` | `string` Optional. The carbon copy recipients of the email draft. Each string MUST be a valid plain email address (e.g., "user@example.com"). If omitted or empty, the existing recipients are preserved. |
| `bcc[]` | `string` Optional. The blind carbon copy recipients of the email draft. Each string MUST be a valid plain email address (e.g., "user@example.com"). If omitted or empty, the existing recipients are preserved. |
| `subject` | `string` Optional. The subject line of the email. If omitted or empty, the existing subject is preserved. |
| `body` | `string` Optional. The plain text body content of the email draft. Do NOT format this field with Markdown (such as headers `#`, bold `**`, bullet points `*`, or tables `|`). If formatted rich text is desired, use `htmlBody` instead. If `htmlBody` is also provided, this field is treated as the plain-text alternative. If both `body` and `htmlBody` are omitted or empty, the existing body is preserved. If `body` is provided but `htmlBody` is omitted, the body will be updated to plain text and the existing HTML body will be cleared. Drive files attached in Gmail appear in the existing body as their Drive links. To keep such a file attached, keep its Drive link in the new `body` or `htmlBody`; to remove it, remove the link (links within quoted history are ignored for chip preservation). |
| `htmlBody` | `string` Optional. The HTML content of the email draft. If provided, this will be used as the rich-text version of the email. Use this field (with valid HTML tags such as `p`, `b`, `ul`, `li`, `h1`) whenever rich text formatting is needed. If both `body` and `htmlBody` are omitted or empty, the existing body is preserved. If `htmlBody` is provided but `body` is omitted, the body will be updated to HTML and the existing plain text body will be cleared. Drive files attached in Gmail are kept only if their Drive links are kept (see `body`). |
| `attachments[]` | ``object (`Attachment`)`` Optional. The attachments to include in the email. The combined size of attachments in the message cannot exceed 25MB. If you need to send files larger than 25MB, upload the file to Drive first and then insert the Drive link into `body` or `htmlBody`. If omitted or empty, any existing attachments on the draft will be removed. This doesn't affect Drive files attached in Gmail (see `body`). |

### Attachment

| JSON representation |
|---|
| ``` { "id": string, "filename": string, "mimeType": string, "content": string, "inline": boolean } ``` |

| Fields ||
|---|---|
| `id` | `string` Output only. When present, contains the ID of an external attachment. |
| `filename` | `string` Optional. The name of the file to be attached, e.g. "invoice.pdf". Email clients show this name to recipients for both regular and inline attachments. If not provided, the attachment may be received with no name. |
| `mimeType` | `string` Optional. The field representing a content or media type must use IANA MIME type, <https://www.iana.org/assignments/media-types/media-types.xhtml>. If not provided, defaults to "application/octet-stream". |
| `content` | `string (bytes format)` Required. The base64-encoded content of the attachment. A base64-encoded string. |
| `inline` | `boolean` Optional. If `true`, this attachment is handled as inline. An inline attachment is content, such as an image, that is displayed within the body of an HTML email instead of being listed as a separate file for download. To display an inline attachment, add an `img` element to `htmlBody` whose `src` is `cid:attN`, where N is the attachment's zero-based position in `attachments`, counting all attachments. For example, if `attachments` contains a PDF followed by an inline PNG, set `src="cid:att1"` on the PNG's `img` element. Don't reference inline attachments by `filename`. Other images in `htmlBody` are removed. If `false` or absent, defaults to `false`, and it's treated as a regular attachment. |

## Output Schema

Details of a draft.

### Draft

| JSON representation |
|---|
| ``` { "id": string, "subject": string, "threadId": string, "toRecipients": [ string ], "ccRecipients": [ string ], "bccRecipients": [ string ], "plaintextBody": string, "date": string, "htmlBody": string, "messageId": string, "sender": string, "snippet": string, "labelIds": [ string ], "raw": string, "viewUrl": string } ``` |

| Fields ||
|---|---|
| `id` | `string` The unique identifier of the draft resource. |
| `subject` | `string` The subject line of the draft message. |
| `threadId` | `string` The ID of the thread this draft belongs to. |
| `toRecipients[]` | `string` List of 'To' recipient email addresses extracted from headers. |
| `ccRecipients[]` | `string` List of 'Cc' recipient email addresses extracted from headers. |
| `bccRecipients[]` | `string` List of 'Bcc' recipient email addresses extracted from headers. |
| `plaintextBody` | `string` Plain text body content, if available. |
| `date` | `string` Date of the draft in RFC 3339 UTC timestamp format (YYYY-MM-DDTHH:MM:SSZ). |
| `htmlBody` | `string` The HTML body content of the draft, if available. |
| `messageId` | `string` The ID of the message associated with this draft. |
| `sender` | `string` Sender email address. |
| `snippet` | `string` Snippet of the message body. |
| `labelIds[]` | `string` The ids of the labels attached to the draft message. |
| `raw` | `string` The raw MIME message content, only populated if MessageFormat was RAW. |
| `viewUrl` | `string` Output only. Web URL to view the draft in the Gmail Web UI. |

### Tool Annotations


[Tool annotations](https://modelcontextprotocol.io/specification/latest/schema#toolannotations) are sent to MCP clients to describe the basic risk of a given tool. Most clients treat these hints as untrusted, but they can be used to decide when a confirmation prompt might be sent to a user.


Along with the title string, the following boolean hints are defined as follows:

- `readOnlyHint`: If true, the tool doesn't modify its environment. Default: false.
- `destructiveHint`: If true, then the tool can perform destructive actions. If false, then the tool can only perform additive actions. Default: true.
- `idempotentHint`: If true, then calling the tool repeatedly with the same arguments will have no additional effect on its environment. Default: false.
- `openWorldHint`: If true, then the tool can interact with an 'open world' of external entities. If false, then the tool can only interact with internal entities. For example, a web search tool would be open world, while a memory tool would not be open world.

Destructive Hint: ❌ \| Idempotent Hint: ❌ \| Read Only Hint: ❌ \| Open World Hint: ❌

## Authorization Scopes

Requires one of the following OAuth scopes:

- `https://mail.google.com/`
- `https://www.googleapis.com/auth/gmail.compose`
- `https://www.googleapis.com/auth/gmail.drafts`
- `https://www.googleapis.com/auth/gmail.modify`