Tool: list_drafts
Lists draft emails from the authenticated user's Gmail account, optionally filtered by a query string.
Note: An empty JSON object {} represents zero matching items, not an error.
The following code sample shows how to use curl to call the list_drafts MCP tool.
| Curl Request |
|---|
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": "list_drafts", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request message for ListDrafts RPC.
ListDraftsRequest
| JSON representation |
|---|
{
"pageSize": integer,
"pageToken": string,
"query": string,
"view": enum ( |
| Fields | |
|---|---|
Union field
|
|
pageSize |
Optional. The maximum number of drafts to return. If unspecified, defaults to 20. The maximum allowed value is 50. |
Union field
|
|
pageToken |
Optional. A token received from a previous |
Union field
|
|
query |
Optional. A query string to filter the drafts. Natural language queries must be pre-converted into Gmail compatible syntax queries to use this tool. If omitted, all drafts (excluding spam and trash by default) are listed. The tool inherently only searches for drafts. Supported Operators by Category: Sender & Recipient:
Time & Date:
Content:
Labels & Categories:
Status:
Size:
Logic & Grouping:
Examples:
A space or a dash ( Note: To retrieve all drafts matching the query, paginate by passing the returned |
Union field
|
|
view |
Optional. Controls the fields populated for drafts in the draft list. Defaults to returning metadata only ( |
DraftView
Enum to control the fields populated for drafts in the response.
| Enums | |
|---|---|
DRAFT_VIEW_UNSPECIFIED |
Unspecified view. Defaults to DRAFT_VIEW_METADATA_ONLY. |
DRAFT_VIEW_METADATA_ONLY |
Returns metadata only (id, threadId, toRecipients, ccRecipients, bccRecipients, date) (if applicable); omits subject and plaintextBody content. |
DRAFT_VIEW_FULL |
Returns full draft content, including subject and plaintextBody in addition to draft metadata (if applicable). |
Output Schema
Response message for ListDrafts RPC.
ListDraftsResponse
| JSON representation |
|---|
{ "drafts": [ { object ( |
| Fields | |
|---|---|
drafts[] |
List of drafts. |
nextPageToken |
A token that can be used in a subsequent call to retrieve the next page of drafts. If the number of drafts matching the query exceeds the |
omittedContent |
Summary of drafts matching the query that were omitted from this page due to security or DLP policy filters. Present only when at least one draft was omitted; |
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 |
The unique identifier of the draft resource. |
subject |
The subject line of the draft message. |
threadId |
The ID of the thread this draft belongs to. |
toRecipients[] |
List of 'To' recipient email addresses extracted from headers. |
ccRecipients[] |
List of 'Cc' recipient email addresses extracted from headers. |
bccRecipients[] |
List of 'Bcc' recipient email addresses extracted from headers. |
plaintextBody |
Plain text body content, if available. |
date |
Date of the draft in RFC 3339 UTC timestamp format (YYYY-MM-DDTHH:MM:SSZ). |
htmlBody |
The HTML body content of the draft, if available. |
messageId |
The ID of the message associated with this draft. |
sender |
Sender email address. |
snippet |
Snippet of the message body. |
labelIds[] |
The ids of the labels attached to the draft message. |
raw |
The raw MIME message content, only populated if MessageFormat was RAW. |
viewUrl |
Output only. Web URL to view the draft in the Gmail Web UI. |
OmittedContentSummary
| JSON representation |
|---|
{
"omittedReasonCounts": [
{
object ( |
| Fields | |
|---|---|
omittedReasonCounts[] |
Breakdown of the items omitted from this response due to security or policy filters, with one entry per reason. The total number of omitted items is the sum of |
OmittedReasonCount
| JSON representation |
|---|
{
"reason": enum ( |
| Fields | |
|---|---|
reason |
The reason the items were omitted. |
omittedCount |
Number of items omitted for this reason. |
OmissionReason
Reason why content was omitted from a response.
| Enums | |
|---|---|
OMISSION_REASON_UNSPECIFIED |
Unspecified omission reason. |
SPAM |
Filtered because the thread or message is classified as spam. |
CONFIDENTIAL |
Filtered because the thread or message is in Confidential Mode / IRM. |
ENCRYPTED |
Filtered because the thread or message is client-side encrypted. |
SUSPICIOUS_SENDER |
Filtered because the sender is flagged as suspicious or spoofed. |
SUSPICIOUS_CONTENT |
Filtered because the message content is flagged as phishing or suspicious. |
PROMPT_INJECTION_SUSPECTED |
Filtered because live prompt-injection detection flagged content in the item. |
DATA_PROTECTION_POLICY |
Filtered by an enterprise Data Loss Prevention (DLP) or admin data-access policy. |
Tool Annotations
Tool annotations 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.modifyhttps://www.googleapis.com/auth/gmail.composehttps://www.googleapis.com/auth/gmail.readonlyhttps://www.googleapis.com/auth/gmail.draftshttps://www.googleapis.com/auth/gmail.drafts.readonly