edit_draft
Update an existing draft email by ID, changing only the fields you provide and replacing an exact Markdown section while preserving all other content.
Instructions
Edit an existing draft email by ID. Only the fields you provide are updated — unmentioned fields stay unchanged. Body edits work like an exact text edit: provide old_text copied from the current draft Markdown (draftMarkdown or a complete current read_email Markdown body) and new_text in Markdown only, without raw HTML, to replace that exact section. Use a blank line between paragraphs. The match must occur exactly once, and all unselected content — including reply/forward history — is preserved. Deprecated body is accepted only as an alias for new_text when old_text is also provided. Returns the draft ID and the draft's updated Markdown body (draftMarkdown). Does not support changing inReplyTo or forwardMessageId — those are set at creation time via draft_email. Returns the draft's shareable webUrl when available; recipients must have access to the mailbox to open it.
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": {
"account": "<account>",
"id": "<id>"
},
"name": "edit_draft"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cc | No | ||
| id | Yes | Draft message ID to edit | |
| to | No | ||
| bcc | No | ||
| body | No | Deprecated alias for `new_text`, in Markdown only; raw HTML is not supported. Use a blank line between paragraphs. Body-only full replacement is not supported; provide `old_text` with this field. | |
| account | Yes | ||
| subject | No | ||
| new_text | No | Replacement content for `old_text` in Markdown only; raw HTML is not supported. Use a blank line between paragraphs. The replacement is converted to HTML with optional `include_signature`, then inserted where `old_text` matched. | |
| old_text | No | Exact current Markdown word, phrase or block to replace in the draft body. Copy from draftMarkdown or a complete current read_email Markdown body, never a truncated preview. Must match exactly once; unselected HTML is preserved. Unsafe structural selections are rejected. | |
| new_attachments | No | New file attachments to add to the draft. The server reads the files from disk and base64-encodes them automatically. | |
| include_signature | No | Whether to append the HTML signature to the replacement section: Gmail first, local fallback only when Gmail returns none; other providers use local. If true, don't include a signature in `new_text`/`body`. Only meaningful when replacement content is provided. Returns an error if true but no signature is configured for this account. | |
| remove_attachments | No | Attachment IDs to remove from the draft. Get attachment IDs from read_email. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| edited | Yes | ||
| webUrl | No | ||
| attachments | No | ||
| draftMarkdown | No | ||
| webUrlUnavailableReason | No |