Skip to main content
Glama
proton-mail-mcp

proton-mail-mcp

by sethbang

Count messages

count_messages
Read-onlyIdempotent

Count 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

NameRequiredDescriptionDefault
matchNoOptional 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.
folderNoFolder to count in (default: INBOX). A non-selectable namespace container like `Folders`/`Labels` is rejected.INBOX

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv2.0.1
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / properties / match / properties / larger / exclusiveMinimum
      Added value: +0
    • removedInput schema / properties / match / properties / larger / minimum
      Removed value: --9007199254740991
    • addedInput schema / properties / match / properties / smaller / exclusiveMinimum
      Added value: +0
    • removedInput schema / properties / match / properties / smaller / minimum
      Removed value: --9007199254740991
  2. Changed2 schema fields changedv1.0.2
    • addedInput schema / properties / folder / description
      Added value: +"Folder to count in (default: INBOX). A non-selectable namespace container like `Folders`/`Labels` is rejected."
    • addedInput schema / properties / match / description
      Added value: +"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."
  3. First observedv1.0.1

TDQS

A4.5/5.0
Behavior4/5

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

Adds substantial context beyond the readOnly/idempotent annotations: it discloses the return shape ("Returns just a number (no envelopes fetched)") and two rejection paths — attachment filters and non-selectable namespace containers — the latter with an "actionable error rather than returning 0". This is strong error-behavior disclosure; only the exact error payload format is left unstated.

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?

Four sentences, each carrying distinct information: purpose, return shape, filter restriction with alternative, and error behavior. Purpose is front-loaded and there is no redundant restatement of the name or title.

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 two-parameter, nested-criteria read tool with no output schema, the description covers the return value, the default folder, the unsupported-filter trap, and the container-name failure mode. Nothing an agent needs 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.

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents both `match` and `folder` including the attachment-filter prohibition. The description adds only the rationale (envelope scan defeats the speed promise) and the namespace-container rejection, which is marginal beyond structured data, so baseline 3 applies.

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 ("Count messages in a folder") plus scope ("matching optional search criteria") and immediately distinguishes itself from search_messages via the attachment-filter restriction. An agent can identify the tool's job without opening the 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?

Explicitly names the alternative ("Use search_messages for attachment-based filtering") with the condition that selects it, and states the default behavior when criteria are omitted ("Omit to count every message in the folder"). When-to-use and when-not-to-use are both covered.

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