Skip to main content
Glama

List emails in several accounts

list_emails_batch
Read-only

Search or list emails across up to 20 accounts in one call, returning grouped results per account with folder filters, typed queries, and independent pagination.

Instructions

List or search emails in up to 20 accounts at once, with one result group per account. Filter with query, which takes typed search such as from:ann@example.com is:unread, and use folder for a folder role. Each account pages with its own pageToken.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "accounts": "<accounts>"
    },
    "name": "list_emails_batch"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryNoTyped search. Plain words search the message text; quote a phrase or a value that has spaces. Filters: from:, to:, subject:, in:inbox|sent|drafts|archive|spam|trash|all, is:read, is:unread, is:starred, is:unstarred, has:attachment, -has:attachment, after:YYYY-MM-DD (inclusive) and before:YYYY-MM-DD (exclusive), in UTC. Terms combine with AND; OR and parentheses are searched as text.
folderNo
accountsYes
pageSizeNoDefaults to 25
includeSnippetNoRequest or suppress message previews
includeSearchContextNoInclude a match-centered body excerpt; requires search words in query

Output Schema

NameRequiredDescriptionDefault
dataYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.24.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare this a non-destructive read, so the description's job is lighter. It adds genuinely new behavioral context beyond the annotations and schema: results are grouped per account and paging state is tracked independently per account via pageToken.

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?

Three tight sentences with the batch scope front-loaded, followed by filtering and paging. Minor awkwardness ('folder for a folder role') but no wasted sentences.

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

Completeness4/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 no explanation, and the description covers the two non-obvious aspects: per-account result grouping and per-account paging. It stops short of noting defaults like pageSize or failure behavior for an invalid accountId, but is otherwise sufficient for correct invocation.

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

Parameters4/5

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

Schema coverage is 67%, and the description meaningfully supplements it by showing a concrete typed query example ('from:ann@example.com is:unread') and clarifying that pageToken is scoped per account, which the nested schema does not make obvious. The phrase 'folder for a folder role' adds little over the enum already in the 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?

The description states a specific verb and resource ('List or search emails') plus a distinguishing scope ('up to 20 accounts at once, with one result group per account'), which separates it from the single-account list_emails. It does not, however, differentiate itself from search_emails_batch, the closest sibling, leaving the agent to infer the boundary.

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?

Usage guidance is implied only: filtering goes through query and folder, and each account carries its own pageToken. There is no explicit statement of when to choose this over list_emails or search_emails_batch, nor any exclusion or prerequisite.

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