Skip to main content
Glama

gmail.users.messages.list

Lists messages in a Gmail mailbox, filtered by search query, labels, and spam/trash inclusion, so you can retrieve and paginate message IDs.

Instructions

Lists the messages in the user's mailbox. For more information, see List Gmail messages [HTTP GET]. Returns the requested resource as JSON — request bodies are built from the typed parameters (typed flags win over the params map), or read whole from body_file Siblings over the same resource: batchDelete, batchModify, delete, get, import, insert, modify, send, trash, untrash.

Input Schema

NameRequiredDescriptionDefault
qNo[query parameter] Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid:
queryNoExtra KEY=VALUE query pairs for endpoints whose parameters Discovery does not describe.
paramsNoParameter map merged into the request; typed parameters win.
userIdYes[URL path segment] The user's email address. The special value `me` can be used to indicate the authenticated user.me
dry_runNoReturn the request that would be sent, without sending it.
labelIdsNo
body_fileNoRead the request body from this file ('-' for stdin) instead of building one from the parameters.
pageTokenNo[query parameter] Page token to retrieve a specific page of results in the list.
maxResultsNo[query parameter] Maximum number of messages to return. This field defaults to 100. The maximum allowed value for this field is 500.100
includeSpamTrashNo[query parameter] Include messages from `SPAM` and `TRASH` in the results.false

Output Schema

NameRequiredDescriptionDefault
messagesNo
nextPageTokenNo
resultSizeEstimateNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changed
    • addedInput schema / properties / includeSpamTrash / default
      Added value: +"false"
    • changedInput schema / properties / includeSpamTrash / description
      Previous value: -"Include messages from `SPAM` and `TRASH` in the results."New value: +"[query parameter] Include messages from `SPAM` and `TRASH` in the results."
    • changedInput schema / properties / labelIds / items / description
      Previous value: -"Only return messages with labels that match all of the specified label IDs. Messages in a thread might have labels that other messages in the same thread don't "New value: +"[query parameter] Only return messages with labels that match all of the specified label IDs. Messages in a thread might have labels that other messages in the same thread don't "
    • addedInput schema / properties / maxResults / default
      Added value: +"100"
    • changedInput schema / properties / maxResults / description
      Previous value: -"Maximum number of messages to return. This field defaults to 100. The maximum allowed value for this field is 500."New value: +"[query parameter] Maximum number of messages to return. This field defaults to 100. The maximum allowed value for this field is 500."
    • addedInput schema / properties / maxResults / format
      Added value: +"uint32"
    • changedInput schema / properties / pageToken / description
      Previous value: -"Page token to retrieve a specific page of results in the list."New value: +"[query parameter] Page token to retrieve a specific page of results in the list."
    • changedInput schema / properties / q / description
      Previous value: -"Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, `\"from:someuser@example.com rfc822msgid:"New value: +"[query parameter] Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, `\"from:someuser@example.com rfc822msgid:"
    • addedInput schema / properties / userId / default
      Added value: +"me"
    • changedInput schema / properties / userId / description
      Previous value: -"The user's email address. The special value `me` can be used to indicate the authenticated user."New value: +"[URL path segment] The user's email address. The special value `me` can be used to indicate the authenticated user."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "messages": {
      +      "items": {
      +        "properties": {
      +          "classificationLabelValues": {
      +            "items": {
      +              "properties": {
      +                "fields": {
      +                  "items": {
      +                    "properties": {
      +                      "fieldId": {
      +                        "type": "string"
      +                      },
      +                      "selection": {
      +                        "type": "string"
      +                      }
      +                    },
      +                    "type": "object"
      +                  },
      +                  "type": "array"
      +                },
      +                "labelId": {
      +                  "type": "string"
      +                }
      +              },
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          "historyId": {
      +            "type": "string"
      +          },
      +          "id": {
      +            "type": "string"
      +          },
      +          "internalDate": {
      +            "type": "string"
      +          },
      +          "labelIds": {
      +            "items": {
      +              "type": "string"
      +            },
      +            "type": "array"
      +          },
      +          "payload": {
      +            "properties": {
      +              "body": {
      +                "properties": {
      +                  "attachmentId": {
      +                    "type": "string"
      +                  },
      +                  "data": {
      +                    "type": "string"
      +                  },
      +                  "size": {
      +                    "type": "integer"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "filename": {
      +                "type": "string"
      +              },
      +              "headers": {
      +                "items": {
      +                  "properties": {
      +                    "name": {
      +                      "type": "string"
      +                    },
      +                    "value": {
      +                      "type": "string"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              },
      +              "mimeType": {
      +                "type": "string"
      +              },
      +              "partId": {
      +                "type": "string"
      +              },
      +              "parts": {
      +                "items": {
      +                  "properties": {
      +                    "body": {
      +                      "type": "object"
      +                    },
      +                    "filename": {
      +                      "type": "string"
      +                    },
      +                    "headers": {
      +                      "items": {
      +                        "type": "object"
      +                      },
      +                      "type": "array"
      +                    },
      +                    "mimeType": {
      +                      "type": "string"
      +                    },
      +                    "partId": {
      +                      "type": "string"
      +                    },
      +                    "parts": {
      +                      "items": {
      +                        "type": "object"
      +                      },
      +                      "type": "array"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              }
      +            },
      +            "type": "object"
      +          },
      +          "raw": {
      +            "type": "string"
      +          },
      +          "sizeEstimate": {
      +            "type": "integer"
      +          },
      +          "snippet": {
      +            "type": "string"
      +          },
      +          "threadId": {
      +            "type": "string"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "nextPageToken": {
      +      "type": "string"
      +    },
      +    "resultSizeEstimate": {
      +      "type": "integer"
      +    }
      +  },
      +  "type": "object"
      +}
  2. First observed

TDQS

B3.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full disclosure burden. It does useful work by flagging the HTTP GET semantics (a read operation) and explaining the request-construction contract — typed parameters override the `params` map, and `body_file` can supply a whole body instead. However, it says nothing about pagination behavior, quota/rate limits, or auth scope expectations, which matter for a 10-parameter list endpoint.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core sentence is front-loaded and efficient, but the second half is templated boilerplate ('Returns the requested resource as JSON...') and the long undifferentiated sibling dump adds volume without routing value. It is not bloated enough to hurt, but several clauses don't earn their place on a simple list endpoint.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists and the schema documents parameters well, so return-shape explanation is unnecessary. What is missing is the operational context an agent needs to call this correctly: that results are paginated via pageToken, that threads.list is the alternative when thread-level results are wanted, and that messages are returned as stubs needing messages.get for bodies.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 90%, so the schema already documents q, labelIds, pageToken, maxResults, includeSpamTrash and userId thoroughly. The description's only parameter-adjacent content is the generic precedence rule for `params` vs typed arguments and `body_file`, which the schema itself also states. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Lists the messages in the user's mailbox,' backed by the Gmail list-messages guide link and explicit HTTP GET. It enumerates the sibling operations on the same resource, so an agent can tell it is the read/list arm, though the enumeration itself doesn't explain how it differs from gmail.users.threads.list or messages.get.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no when-to-use or when-not-to-use guidance. The sibling sentence is a bare enumeration ('batchDelete, batchModify, delete, get, import, insert, modify, send, trash, untrash') with no conditions attached, so the agent must infer that this is the listing counterpart to get/threads.list. Nothing says when to prefer threads.list or how labelIds/q filtering should be chosen.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools