Skip to main content
Glama
hgn

Notmuch

by hgn

Count mail

mail_count
Read-only

Count messages or threads matching a query to quickly check how many emails exist from a sender, subject, or time range before running a full search.

Instructions

Count messages or threads matching a query, without fetching any of them.

Cheap way to check whether a correspondent, subject or thread exists at all before running a full mail_search, e.g. "how many mails did I get from X" (count="messages", the right default) versus "how many separate conversations" (count="threads"). Not a substitute for mail_search when you need to see the matches themselves.

Args: query: A notmuch query, e.g. 'from:alice'. See notmuch-search-terms(7) for the full syntax, including relative date ranges such as 'date:this_year..', 'date:last_month..', 'date:1Y..' and 'date:2026-01-01..2026-06-30'. scope: Name of a configured scope to AND with query (see mail_list_scopes). Defaults to the configured default scope. count: 'messages' or 'threads'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNomessages
queryYes
scopeNo
Behavior4/5

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

Annotations already declare readOnlyHint=true, but the description adds valuable behavior: 'without fetching any of them' clarifies that no message content is retrieved, and 'cheap way' signals performance characteristics. This goes beyond the annotation's basic safety profile, though it doesn't cover all possible edge cases.

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?

The description is front-loaded with the core statement, followed by usage context and an Args section. Every sentence adds value—examples for query syntax, scope behavior, and count semantics are all relevant. No fluff.

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 count tool with no output schema, the description sufficiently implies the return value (a count) while covering query syntax, scope, and count modes. The mention of default scope and examples of date ranges makes it complete for the tool's complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

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

Even though schema property descriptions are absent (0% coverage), the description thoroughly explains each parameter: the query syntax with notmuch examples and date ranges, the scope default behavior, and the count options ('messages' or 'threads'). This fully compensates for the schema's lack of descriptions.

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?

The description opens with 'Count messages or threads matching a query'—a specific verb and resource that clearly states the tool's function. It distinguishes itself from siblings by explicitly stating it doesn't fetch matches and is not a substitute for mail_search.

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?

Provides explicit usage context: it's a 'cheap way to check whether a correspondent, subject or thread exists' before running a full mail_search, and explicitly says 'Not a substitute for mail_search when you need to see the matches themselves.' This gives clear when-to-use and when-not-to-use guidance relative to alternatives.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hgn/mcp-server-notmuch'

If you have feedback or need assistance with the MCP directory API, please join our Discord server