# MCP Tools Reference: gmailmcp.googleapis.com

## 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 |
|---|
| ```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": "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 (`DraftView`) } ``` |

| Fields ||
|---|---|
| Union field `_page_size`. `_page_size` can be only one of the following: ||
| `pageSize` | `integer` Optional. The maximum number of drafts to return. If unspecified, defaults to 20. The maximum allowed value is 50. |
|   ||
| Union field `_page_token`. `_page_token` can be only one of the following: ||
| `pageToken` | `string` Optional. A token received from a previous `list_drafts` call to retrieve the next page of results. Leave empty to fetch the first page. This is primarily used for pagination to continue fetching results from where the previous `list_drafts` call left off, especially when the number of drafts matching the query exceeds the `pageSize` limit. |
|   ||
| Union field `_query`. `_query` can be only one of the following: ||
| `query` | `string` 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: - `from:EMAIL` - Sent from a specific person. - `to:EMAIL` - Sent to a specific person. - `cc:EMAIL` - Specific people in Cc. - `bcc:EMAIL` - Specific people in Bcc. - `deliveredto:EMAIL` - Delivered to a specific address. - `list:EMAIL` - From a specific mailing list. Time \& Date: - `after:YYYY/MM/DD` / `newer:YYYY/MM/DD` - Received after a date (evaluates against midnight 00:00:00 of that day, inclusive). - `before:YYYY/MM/DD` / `older:YYYY/MM/DD` - Received before a date (evaluates against midnight 00:00:00 of that day, exclusive; excludes that day). To search through a specific day D (or for a single day D), set `before:` to the day after (for example, `after:2026/02/01 before:2026/02/02` for Feb 1, or `after:2026/02/01 before:2026/02/06` for Feb 1-5). - `older_than:DURATION` - Older than a duration (for example, `1y`, `2d`). - `newer_than:DURATION` - Newer than a duration. Content: - `subject:WORDS` - Words in the subject line. - `has:TYPE` - Has specific content types (attachment, drive, youtube, document). - `filename:NAME` - Attachment with a specific name or type. - `"PHRASE"` - Search for an exact word or phrase. (for example, `"holiday"`, `"holiday vacation"`). - `+WORD` - Match a word exactly. (for example, `+holiday`, `+unicorn`) - `rfc822msgid:ID` - Specific message ID header. - `AROUND N` - Find words near each other (for example, `holiday AROUND 10 vacation`). Labels \& Categories: - `label:NAME` - Under a specific label, matched by its display name (the `name` from `list_labels`), for example `label:wins`. Label IDs such as `Label_123` match nothing. Quote a name that contains spaces (`label:"Board Prep"`) or replace its spaces and `/` with `-` (`label:board-prep`). - `category:NAME` - In a category (primary, social, promotions, updates, forums, reservations, purchases). - `has:userlabels` - Has any user labels. - `has:nouserlabels` - Does not have any user labels. - `has:*-star` - Specific star colors (if enabled, for example, `has:yellow-star`). Status: - `is:STATUS` - Search by status (important, starred, unread, read, muted). Size: - `size:BYTES` - Specific size in bytes. - `larger:SIZE` / `smaller:SIZE` - Larger or smaller than a size (for example, `10M` for 10 MB). Logic \& Grouping: - `AND` - Match all criteria (default behavior). - `OR` or `{ }` - Match one or more criteria (for example, `from:amy OR from:david`, `{from:amy from:david}`). - `-` (minus) - Exclude criteria (for example, `-movie`). - `( )` - Group multiple search terms (for example, `subject:(dinner film)`). Examples: - `subject:Project Update` - `from:gduser1@workspacesamples.dev` - `to:gduser2@workspacesamples.dev AND newer_than:7d` - `project proposal has:attachment` - `is:unread` A space or a dash (`-`) separates numbers, while a dot (`.`) is treated as a decimal. For example, `01.2047-100` is considered two numbers: `01.2047` and `100`. To search for hyphenated or dotted identifiers (such as order numbers, tracking IDs, or invoice codes like `INV-12345`), enclose them in double quotes (e.g., `"INV-12345"` or `"01.2047-100"`) so the dash is not interpreted as a negation operator and exact phrase matching is preserved. Note: To retrieve all drafts matching the query, paginate by passing the returned `nextPageToken` in `pageToken` until `nextPageToken` is absent. A page may return an empty `drafts` list while `nextPageToken` is still present if matching drafts were omitted by security or policy filters. |
|   ||
| Union field `_view`. `_view` can be only one of the following: ||
| `view` | ``enum (`DraftView`)`` Optional. Controls the fields populated for drafts in the draft list. Defaults to returning metadata only (`id`, `threadId`, `toRecipients`, `ccRecipients`, `bccRecipients`, `date`). Set to `DRAFT_VIEW_FULL` to include `subject` and `plaintextBody` content. |
|   ||

### 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 (`Draft`) } ], "nextPageToken": string, "omittedContent": { object (`OmittedContentSummary`) } } ``` |

| Fields ||
|---|---|
| `drafts[]` | ``object (`Draft`)`` List of drafts. |
| `nextPageToken` | `string` 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 `pageSize` limit, the response will contain a `nextPageToken`. To retrieve the next page of results, pass this token in the `pageToken` field of the next `ListDraftsRequest`. |
| `omittedContent` | ``object (`OmittedContentSummary`)`` 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; `omittedReasonCounts` gives the number of omitted drafts per reason. A page may contain fewer drafts than `pageSize`, or no drafts at all, while `nextPageToken` is still set: if `drafts` is empty and `nextPageToken` is present, continue paginating to find more results. If `nextPageToken` is absent, there are no more results; tell the user how many drafts were omitted and why. |

### 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. |

### OmittedContentSummary

| JSON representation |
|---|
| ``` { "omittedReasonCounts": [ { object (`OmittedReasonCount`) } ] } ``` |

| Fields ||
|---|---|
| `omittedReasonCounts[]` | ``object (`OmittedReasonCount`)`` 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 `omittedCount` across all entries. |

### OmittedReasonCount

| JSON representation |
|---|
| ``` { "reason": enum (`OmissionReason`), "omittedCount": integer } ``` |

| Fields ||
|---|---|
| `reason` | ``enum (`OmissionReason`)`` The reason the items were omitted. |
| `omittedCount` | `integer` 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](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.modify`
- `https://www.googleapis.com/auth/gmail.compose`
- `https://www.googleapis.com/auth/gmail.readonly`
- `https://www.googleapis.com/auth/gmail.drafts`
- `https://www.googleapis.com/auth/gmail.drafts.readonly`