Skip to main content
Glama

Search mail

search_messages
Read-only

Find emails across mailboxes by sender, subject, text, date, folder, read/starred status, or attachments, returning newest-first summaries with IDs and pagination cursors for follow-up.

Instructions

Find mail, newest first. All filters narrow together. To search every folder, give folder all. Without an account it searches every account you may read, or those of account_ids, and folder must be a role. It reads only and marks nothing read. Answers summaries with ids and a next_cursor for more, each with sender_check, the receiving server's check of the domain in from. get_message reads one mail, get_thread a whole conversation. For what arrived since an earlier call, use whats_new.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "search_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
toNoPart of To. One line, at most 200 characters
textNoAnywhere in the mail. One line, at most 200 characters
afterNoReceived from this day, YYYY-MM-DD
limitNoAt most this many in one answer
beforeNoReceived before this day, YYYY-MM-DD
cursorNonext_cursor of the previous call, for more
folderNoFolder id, or a role such as inbox, sent, archive. Left out: the inbox. all: every folder but the trash and junk, where the account has it
senderNoPart of From. One line, at most 200 characters
unreadNotrue: unread mail only. false: read mail only
starredNotrue: starred mail only. false: the rest only
subjectNoPart of the subject. One line, at most 200 characters
account_idNoOne account. Left out: every account, or those of account_ids
account_idsNoSeveral accounts, not beside account_id. Left out: every account
has_attachmentsNotrue: mail with attachments only. false: without

Output Schema

NameRequiredDescriptionDefault
noteYes
messagesYes
next_cursorYes
accounts_not_answeringNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.8.0
    • addedOutput schema / $defs
      Added value: +{
      +  "SenderCheck": {
      +    "description": "The receiving server's check of the domain in from: its result,\nthe domain where it named one, and why it is unknown.",
      +    "properties": {
      +      "domain": {
      +        "title": "Domain",
      +        "type": "string"
      +      },
      +      "reason": {
      +        "title": "Reason",
      +        "type": "string"
      +      },
      +      "result": {
      +        "title": "Result",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "result"
      +    ],
      +    "title": "SenderCheck",
      +    "type": "object"
      +  },
      +  "Summary": {
      +    "properties": {
      +      "account_id": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "title": "Account Id"
      +      },
      +      "date": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "title": "Date"
      +      },
      +      "folders": {
      +        "items": {
      +          "type": "string"
      +        },
      +        "title": "Folders",
      +        "type": "array"
      +      },
      +      "from": {
      +        "title": "From",
      +        "type": "string"
      +      },
      +      "has_attachments": {
      +        "title": "Has Attachments",
      +        "type": "boolean"
      +      },
      +      "id": {
      +        "title": "Id",
      +        "type": "string"
      +      },
      +      "keywords": {
      +        "items": {
      +          "type": "string"
      +        },
      +        "title": "Keywords",
      +        "type": "array"
      +      },
      +      "marks": {
      +        "items": {
      +          "type": "string"
      +        },
      +        "title": "Marks",
      +        "type": "array"
      +      },
      +      "sender_check": {
      +        "$ref": "#/$defs/SenderCheck"
      +      },
      +      "snippet": {
      +        "title": "Snippet",
      +        "type": "string"
      +      },
      +      "starred": {
      +        "title": "Starred",
      +        "type": "boolean"
      +      },
      +      "subject": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "title": "Subject"
      +      },
      +      "thread_id": {
      +        "title": "Thread Id",
      +        "type": "string"
      +      },
      +      "unread": {
      +        "title": "Unread",
      +        "type": "boolean"
      +      }
      +    },
      +    "required": [
      +      "id",
      +      "account_id",
      +      "date",
      +      "from",
      +      "subject",
      +      "unread",
      +      "starred",
      +      "has_attachments",
      +      "folders",
      +      "sender_check"
      +    ],
      +    "title": "Summary",
      +    "type": "object"
      +  }
      +}
    • removedOutput schema / additionalProperties
      Removed value: -true
    • addedOutput schema / description
      Added value: +"A page of summaries, with the accounts that did not answer."
    • addedOutput schema / properties
      Added value: +{
      +  "accounts_not_answering": {
      +    "items": {
      +      "type": "string"
      +    },
      +    "title": "Accounts Not Answering",
      +    "type": "array"
      +  },
      +  "messages": {
      +    "items": {
      +      "$ref": "#/$defs/Summary"
      +    },
      +    "title": "Messages",
      +    "type": "array"
      +  },
      +  "next_cursor": {
      +    "anyOf": [
      +      {
      +        "type": "string"
      +      },
      +      {
      +        "type": "null"
      +      }
      +    ],
      +    "title": "Next Cursor"
      +  },
      +  "note": {
      +    "title": "Note",
      +    "type": "string"
      +  }
      +}
    • addedOutput schema / required
      Added value: +[
      +  "messages",
      +  "next_cursor",
      +  "note"
      +]
    • changedOutput schema / title
      Previous value: -"search_messagesDictOutput"New value: +"Page"
  2. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and openWorldHint, yet the description still adds real behavior: 'All filters narrow together' (conjunctive filter semantics), 'It reads only and marks nothing read' (search has no read-state side effect), and the cross-account constraint that folder must be a role when no account is given. It also explains sender_check, a return-field nuance not obvious from names alone, though pagination limits beyond next_cursor are left to the output schema.

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?

Front-loaded with the resource and scope, then alternatives, then return shape; no filler sentences. The telegraphic fragment style ('give folder all', 'answers summaries with ids') is dense and occasionally clipped, which costs a point on readability but not on substance.

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

Completeness5/5

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

For a 14-parameter tool with an output schema and safety annotations, the description covers what structured fields cannot: filter conjunction, default inbox behavior, cross-account scope, the folder-role restriction, and the read-state guarantee. Nothing needed to call it correctly is missing.

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 100%, so the baseline is 3, but the description adds meaning the schema does not: filters combine with AND rather than widening results, and the account-less mode forces folder to be a role. Those are non-obvious invocation rules that materially change how an agent builds a call.

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

Purpose5/5

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

Opens with a specific verb and resource ('Find mail, newest first') and immediately names the siblings it is not: get_message for one mail, get_thread for a conversation, whats_new for incremental arrival. An agent can distinguish all four without opening a schema.

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

Usage Guidelines5/5

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

Gives explicit routing conditions: 'To search every folder, give folder all', 'For what arrived since an earlier call, use whats_new', and contrasts with get_message/get_thread. The condition selecting each alternative is stated, not implied.

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