Count messages
count_messagesCount emails in a Proton Mail folder that match search criteria such as sender, subject, date, or size. Returns only the total number without fetching envelopes, so you get quick mailbox counts.
Instructions
Count messages in a folder matching optional search criteria. Returns just a number (no envelopes fetched). The attachment filters (hasAttachment, attachmentName, attachmentType) are rejected here — they require an envelope scan that defeats the count's speed promise. Use search_messages for attachment-based filtering. A non-selectable namespace container (e.g. Folders/Labels) is rejected with an actionable error rather than returning 0.
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": "count_messages"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| match | No | Optional search criteria to narrow the count (same fields as search_messages: from, to, subject, body, since, before, seen, flagged, larger, smaller, listId). Attachment filters are NOT allowed here — use search_messages for those. Omit to count every message in the folder. | |
| folder | No | Folder to count in (default: INBOX). A non-selectable namespace container like `Folders`/`Labels` is rejected. | INBOX |