Skip to main content
Glama

Search multiple accounts

search_emails_batch
Read-only

Search up to 20 email accounts with one portable query and return grouped results per account, so you can compare matches across connected inboxes in one request.

Instructions

Search up to 20 accounts with one portable query and return one result group per account.

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
folderNo
starredNo
subjectNo
accountsYes
pageSizeNoDefaults to 25
hasAttachmentNo
includeSnippetNoRequest or suppress message previews
includeSearchContextNoInclude a match-centered body excerpt; requires a portable text query

Output Schema

NameRequiredDescriptionDefault
dataYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv0.19.0
    • addedInput schema / properties / accounts / items / properties / accountId / maxLength
      Added value: +512
    • 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"
      +  }
      +]
    • 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 / 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. Changed24 schema fields changedv0.15.0
    • addedInput schema / properties / accounts / items / properties / pageToken / anyOf
      Added value: +[
      +  {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / accounts / items / properties / pageToken / minLength
      Removed value: -1
    • removedInput schema / properties / accounts / items / properties / pageToken / 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: +[
      +  {
      +    "enum": [
      +      "inbox",
      +      "sent",
      +      "drafts",
      +      "archive",
      +      "spam",
      +      "trash",
      +      "all"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / folder / enum
      Removed value: -[
      -  "inbox",
      -  "sent",
      -  "drafts",
      -  "archive",
      -  "spam",
      -  "trash",
      -  "all"
      -]
    • 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"
    • 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"
      +        },
      +        "groups": {
      +          "items": {
      +            "additionalProperties": true,
      +            "properties": {
      +              "accountId": {
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "accountId"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        }
      +      },
      +      "required": [
      +        "groups",
      +        "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. Addedv0.9.0

TDQS

B3.1/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 by structured data. The description adds genuine context beyond that: the batch cap of 20 and the per-account result grouping. It omits important behavior for a fan-out call such as partial failures (what happens if one account errors), per-account pagination via pageToken, and rate-limit behavior.

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?

A single front-loaded sentence with no filler; the batch scope and the return grouping both land immediately. It is arguably too terse for a 14-parameter fan-out tool, but that is a completeness problem rather than a structural one.

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

Completeness2/5

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

For a 14-parameter, multi-account fan-out operation, the description covers only the account count and result grouping. With 43% schema coverage, an output schema present, and annotations carrying safety, the missing pieces are the ones an agent most needs: per-account pagination semantics, partial-failure behavior, and how the many filter parameters combine with the portable query.

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

Parameters2/5

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

Schema description coverage is only 43% across 14 parameters, so the description is expected to compensate, but it does not. It mentions only the query ('one portable query') and the accounts cap; it says nothing about the accounts[].pageToken field for per-account paging, pageSize behavior across accounts, or how the filter parameters (from/to/subject/folder/starred) interact with the portable query syntax.

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?

The description names a specific verb (search) plus the distinctive scope (up to 20 accounts in one call) and the return shape (one result group per account), which clearly separates it from the single-account search_emails sibling. It never names that sibling explicitly, so the differentiation is inferred rather than stated.

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

Usage Guidelines3/5

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

The 'up to 20 accounts' bound implies this is the multi-account variant of search, giving an implied usage condition. However, there is no explicit statement of when to prefer this over search_emails, no guidance on when a batch is inappropriate, and no note on prerequisites (e.g., whether all accountIds must be authorized).

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