Skip to main content
Glama

search_emails

Read-only

Search a connected email account using portable query syntax to find messages by sender, recipient, subject, folder, read or starred state, attachments, or date range.

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

TableJSON 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

TableJSON Schema
NameRequiredDescriptionDefault
dataYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.11.1
    • removedOutput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
  2. 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"
      +}
  3. 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"
      +}
  4. Changed1 schema field changedv0.9.0
    • addedInput schema / properties / includeSnippet
      Added value: +{
      +  "description": "Request or suppress message previews",
      +  "type": "boolean"
      +}
  5. 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, so the safety profile is covered. The description usefully notes the account scope and the portable query capability, but says nothing about pagination behavior, result limits, or that rawProviderQuery only works on a single compatible account (schema-only detail).

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 tight sentences, front-loaded with the core operation and followed by capability enumeration. No wasted text, though the second sentence is essentially a feature list.

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 so return values need not be explained, and required params are clear. But for a 16-parameter search tool with no usage guidance and gaps on pagination and provider-native queries, the description leaves meaningful holes for correct invocation.

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?

With 16 parameters and only 63% schema description coverage, many fields (to, from, read, starred, subject, hasAttachment) have no schema description at all. The description lists the supported query operators, which partially compensates by implying which filters exist, but it does not explain rawProviderQuery, includeSnippet, includeSearchContext, accountId resolution, or pagination.

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') and scopes it to a single account, which implicitly distinguishes it from the batch sibling. However, it never names search_emails_batch or list_emails, so the differentiation is left for the agent to infer.

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 guidance, no prerequisites, and no mention of the obvious alternative search_emails_batch for multi-account search. The 'one account' phrase hints at scope but does not route the agent explicitly.

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