Scan Email Headers
scan_messagesScan Microsoft 365 message headers by folder, filter, or search to find relevant emails, then use returned refs to open messages, list attachments, or move them; follow cursors for paged results.
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
| Name | Required | Description | Default |
|---|---|---|---|
| top | No | Rows per page (default 100, max 1000) | |
| cursor | No | Continuation cursor from a prior scan. Pass alone, plus mailbox if the scan named one; valid for this session | |
| filter | No | OData filter, e.g. receivedDateTime ge 2026-01-01T00:00:00Z | |
| folder | No | Folder to scan: well-known name (archive, inbox, sentitems), display name, or ID. Default: all mail | |
| search | No | Full-text search term. Cannot be combined with date ordering | |
| mailbox | No | Email 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. |