Skip to main content
Glama

Scan Email Headers

scan_messages
Read-only

Scan message headers as compact refs, scoped by folder and narrowed by filter or search; follow returned cursors to page through incomplete results and pass refs to message tools.

Instructions

Scan message headers compactly as ref|received|from|subject|flags. Scope with folder and narrow with filter or search. Pass refs to get_message, list_attachments, move_message or batch_move_messages. Both filter and search scans page using Graph nextLink cursors: when a result says INCOMPLETE, call scan_messages with the returned cursor alone until no cursor remains. A short or empty page can still have a continuation. Search returns at most 1,000 results, so use filter and exhaust its cursors when mailbox coverage matters. A header is not a message: open messages and attachments the subject cannot rule out.

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": "scan_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
topNoRows per page (default 100, max 1000)
cursorNoContinuation cursor from a prior scan. Pass alone, plus mailbox if the scan named one. Each cursor works once; an unused one can expire, and then the scan must be re-run
filterNoOData filter, e.g. receivedDateTime ge 2026-01-01T00:00:00Z. Results come newest first. Not with search
folderNoFolder to scan: well-known name (archive, inbox, sentitems), display name, or ID. Default: all mail
searchNoFull-text search term. Results are not date-ordered. Not with filter: Graph can't combine them
mailboxNoEmail address of another mailbox to act on (delegated or shared), e.g. 'someone@example.com'. Omit for your own mailbox; required when this server signs in as an application. Only addresses this server is configured to allow will be accepted.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.5.0
    • changedInput schema / properties / cursor / description
      Previous value: -"Continuation cursor from a prior scan. Pass alone, plus mailbox if the scan named one; valid for this session"New value: +"Continuation cursor from a prior scan. Pass alone, plus mailbox if the scan named one. Each cursor works once; an unused one can expire, and then the scan must be re-run"
    • changedInput schema / properties / filter / description
      Previous value: -"OData filter, e.g. receivedDateTime ge 2026-01-01T00:00:00Z"New value: +"OData filter, e.g. receivedDateTime ge 2026-01-01T00:00:00Z. Results come newest first. Not with search"
    • changedInput schema / properties / search / description
      Previous value: -"Full-text search term. Cannot be combined with date ordering"New value: +"Full-text search term. Results are not date-ordered. Not with filter: Graph can't combine them"
  2. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=true, but the description discloses genuine behavior: pagination via Graph nextLink cursors, the INCOMPLETE marker, cursor single-use and expiry, the warning that a short or empty page can still have a continuation, and the 1,000-result search cap. These are exactly the operational traits an agent would otherwise get wrong.

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

Conciseness5/5

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

Six sentences, each carrying distinct load, with the output format front-loaded before scoping and paging details. No filler or restatement of the tool name.

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?

Covers everything an agent needs for a paging, header-only scan tool with no output schema: result format, scoping, narrowing, continuation protocol, coverage limits, and the boundary between headers and full messages. Nothing material is left to inference.

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 100% and the parameter descriptions are already detailed (cursor 'pass alone', filter/search mutual exclusion, folder defaults, mailbox delegation rules), so the description mostly reinforces rather than adds. The only real additions at parameter level are the semantics of exhausting filter cursors for coverage and the search result ceiling.

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?

States a specific verb and resource ('Scan message headers') and immediately defines the return shape as ref|received|from|subject|flags. It also distinguishes itself from message-reading tools with 'A message is not a header: open messages... with get_message', so an agent knows this is a lightweight enumeration, not a fetch.

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?

Explicit routing is given: scope with folder, narrow with filter or search, and pass refs to get_message, list_attachments, move_message or batch_move_messages. It also states the selection rule between the two narrowing modes ('Search returns at most 1,000 results, so use filter and exhaust its cursors when mailbox coverage matters') and when to escalate to opening full messages.

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

Deploy Server

Other Tools