Skip to main content
Glama

Search emails

search_emails
Read-only

Find messages in one connected account using typed portable syntax, filtering by sender, recipient, subject, folder, read or starred state, attachments, and dates to locate relevant mail.

Instructions

Search one account with typed portable syntax. The query supports text, from:, to:, subject:, in:, read and starred states, attachments, and date filters.

Input Schema

NameRequiredDescriptionDefault
toNo
fromNo
readNo
afterNoYYYY-MM-DD received date, inclusive in UTC
queryYesTyped portable search syntax
beforeNoYYYY-MM-DD received date, exclusive in UTC
folderNoFolder role (inbox, sent, drafts, trash, spam, starred, archive, all) or a label/folder name. Use all or omit this field to search all mail except Spam and Trash. An IMAP server's \All mailbox may use different rules.
starredNo
subjectNo
pageSizeNoDefaults to 25
accountIdNoAccount to operate on. Optional when exactly one account is connected.
pageTokenNonextPageToken from a previous call
hasAttachmentNo
includeSnippetNoRequest or suppress message previews
rawProviderQueryNoProvider-native Gmail syntax or Outlook KQL for one compatible account
includeSearchContextNoInclude a match-centered body excerpt; requires a portable text query

Output Schema

NameRequiredDescriptionDefault
dataYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed13 schema fields changedv0.19.0
    • changedInput schema / properties / accountId / anyOf
      Previous value: -[
      -  {
      -    "minLength": 1,
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "maxLength": 512,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / after / anyOf
      Previous value: -[
      -  {
      -    "minLength": 1,
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / before / anyOf
      Previous value: -[
      -  {
      -    "minLength": 1,
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / folder / anyOf
      Previous value: -[
      -  {
      -    "minLength": 1,
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "maxLength": 2048,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / from / anyOf
      Added value: +[
      +  {
      +    "maxLength": 2048,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / from / type
      Removed value: -[
      -  "string",
      -  "null"
      -]
    • addedInput schema / properties / query / maxLength
      Added value: +2048
    • addedInput schema / properties / rawProviderQuery / anyOf
      Added value: +[
      +  {
      +    "maxLength": 2048,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / rawProviderQuery / type
      Removed value: -[
      -  "string",
      -  "null"
      -]
    • addedInput schema / properties / subject / anyOf
      Added value: +[
      +  {
      +    "maxLength": 2048,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / subject / type
      Removed value: -[
      -  "string",
      -  "null"
      -]
    • addedInput schema / properties / to / anyOf
      Added value: +[
      +  {
      +    "maxLength": 2048,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / to / type
      Removed value: -[
      -  "string",
      -  "null"
      -]
  2. Changed28 schema fields changedv0.15.0
    • addedInput schema / properties / accountId / anyOf
      Added value: +[
      +  {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / accountId / minLength
      Removed value: -1
    • removedInput schema / properties / accountId / type
      Removed value: -"string"
    • addedInput schema / properties / after / anyOf
      Added value: +[
      +  {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / after / minLength
      Removed value: -1
    • removedInput schema / properties / after / type
      Removed value: -"string"
    • addedInput schema / properties / before / anyOf
      Added value: +[
      +  {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / before / minLength
      Removed value: -1
    • removedInput schema / properties / before / type
      Removed value: -"string"
    • addedInput schema / properties / folder / anyOf
      Added value: +[
      +  {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / folder / minLength
      Removed value: -1
    • removedInput schema / properties / folder / type
      Removed value: -"string"
    • changedInput schema / properties / from / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedInput schema / properties / hasAttachment / type
      Previous value: -"boolean"New value: +[
      +  "boolean",
      +  "null"
      +]
    • changedInput schema / properties / includeSearchContext / type
      Previous value: -"boolean"New value: +[
      +  "boolean",
      +  "null"
      +]
    • changedInput schema / properties / includeSnippet / type
      Previous value: -"boolean"New value: +[
      +  "boolean",
      +  "null"
      +]
    • addedInput schema / properties / pageSize / anyOf
      Added value: +[
      +  {
      +    "maximum": 100,
      +    "minimum": 1,
      +    "type": "integer"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / pageSize / maximum
      Removed value: -100
    • removedInput schema / properties / pageSize / minimum
      Removed value: -1
    • removedInput schema / properties / pageSize / type
      Removed value: -"integer"
    • addedInput schema / properties / pageToken / anyOf
      Added value: +[
      +  {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / pageToken / minLength
      Removed value: -1
    • removedInput schema / properties / pageToken / type
      Removed value: -"string"
    • changedInput schema / properties / rawProviderQuery / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedInput schema / properties / read / type
      Previous value: -"boolean"New value: +[
      +  "boolean",
      +  "null"
      +]
    • changedInput schema / properties / starred / type
      Previous value: -"boolean"New value: +[
      +  "boolean",
      +  "null"
      +]
    • changedInput schema / properties / subject / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedInput schema / properties / to / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
  3. Changed1 schema field changedv0.11.1
    • removedOutput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
  4. Changed1 schema field changedv0.11.0
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "data": {
      +      "additionalProperties": true,
      +      "properties": {
      +        "exhausted": {
      +          "type": "boolean"
      +        },
      +        "items": {
      +          "items": {
      +            "additionalProperties": true,
      +            "properties": {
      +              "accountId": {
      +                "type": "string"
      +              },
      +              "attachments": {
      +                "items": {
      +                  "additionalProperties": true,
      +                  "properties": {
      +                    "filename": {
      +                      "type": "string"
      +                    },
      +                    "id": {
      +                      "type": "string"
      +                    },
      +                    "mimeType": {
      +                      "type": "string"
      +                    },
      +                    "sizeBytes": {
      +                      "type": "number"
      +                    }
      +                  },
      +                  "required": [
      +                    "id",
      +                    "filename",
      +                    "mimeType",
      +                    "sizeBytes"
      +                  ],
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              },
      +              "body": {
      +                "additionalProperties": false,
      +                "properties": {
      +                  "html": {
      +                    "type": "string"
      +                  },
      +                  "text": {
      +                    "type": "string"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "bodyTruncation": {
      +                "additionalProperties": {
      +                  "additionalProperties": false,
      +                  "properties": {
      +                    "nextOffset": {
      +                      "type": "number"
      +                    },
      +                    "totalChars": {
      +                      "type": "number"
      +                    }
      +                  },
      +                  "required": [
      +                    "totalChars"
      +                  ],
      +                  "type": "object"
      +                },
      +                "type": "object"
      +              },
      +              "date": {
      +                "type": "string"
      +              },
      +              "flags": {
      +                "additionalProperties": true,
      +                "properties": {
      +                  "draft": {
      +                    "type": "boolean"
      +                  },
      +                  "read": {
      +                    "type": "boolean"
      +                  },
      +                  "starred": {
      +                    "type": "boolean"
      +                  }
      +                },
      +                "required": [
      +                  "read",
      +                  "starred",
      +                  "draft"
      +                ],
      +                "type": "object"
      +              },
      +              "id": {
      +                "type": "string"
      +              },
      +              "subject": {
      +                "type": "string"
      +              },
      +              "threadId": {
      +                "type": "string"
      +              },
      +              "to": {
      +                "items": {
      +                  "additionalProperties": true,
      +                  "properties": {
      +                    "email": {
      +                      "type": "string"
      +                    },
      +                    "name": {
      +                      "type": "string"
      +                    }
      +                  },
      +                  "required": [
      +                    "email"
      +                  ],
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              }
      +            },
      +            "required": [
      +              "id",
      +              "threadId",
      +              "accountId",
      +              "to",
      +              "subject",
      +              "date",
      +              "flags"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "nextPageToken": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "items",
      +        "exhausted"
      +      ],
      +      "type": "object"
      +    }
      +  },
      +  "required": [
      +    "data"
      +  ],
      +  "type": "object"
      +}
  5. Changed1 schema field changedv0.10.0
    • addedInput schema / properties / includeSearchContext
      Added value: +{
      +  "description": "Include a match-centered body excerpt; requires a portable text query",
      +  "type": "boolean"
      +}
  6. Changed1 schema field changedv0.9.0
    • addedInput schema / properties / includeSnippet
      Added value: +{
      +  "description": "Request or suppress message previews",
      +  "type": "boolean"
      +}
  7. First observedv0.1.0

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false and openWorldHint=false, so safety is covered; the description's real contribution is enumerating the query operators (from:, in:, read, starred, attachments, dates). It does not disclose how the free-text query interacts with the parallel structured fields, nor pagination/result ordering behavior for what is clearly a paginated, 16-parameter search.

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

Conciseness4/5

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

Two sentences, front-loaded with the core action, and no filler. It is efficient, though the second sentence is a raw operator list rather than prioritized information about how to combine inputs.

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?

Output schema exists, so return values need no explanation, and the query grammar summary is genuinely useful. But for a 16-parameter search tool with an alternative syntax path (rawProviderQuery) and a structured-filter path, the description omits how these compose and when each is preferred — a material gap.

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 coverage is 63%, so several parameters (to, from, read, starred, subject, hasAttachment) have no schema descriptions; the description partially compensates by listing the equivalent query operators. It does not explain precedence between query, structured filters, and rawProviderQuery, which is the most consequential semantic question for this schema.

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 ("Search one account") plus the key mechanism ("typed portable syntax"), which tells an agent what the tool does. However, it never names the siblings it sits beside — list_emails and search_emails_batch — so the "one account" scoping is the only implicit differentiation.

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 explicit when-to-use guidance: nothing says when to pick this over list_emails, or when to use search_emails_batch for multiple accounts. The only hint is the phrase "one account", which forces the agent to infer the batching alternative from a sibling tool name alone.

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