Skip to main content
Glama
MadLlama25

Fastmail MCP Server

by MadLlama25

list_emails

Retrieve emails from a Fastmail mailbox with optional filtering by mailbox, result limit, and sort order (newest or oldest first).

Instructions

List emails from a mailbox

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mailboxIdNoID of the mailbox to list emails from (optional, defaults to all)
limitNoMaximum number of emails to return (default: 20)
ascendingNoSort oldest first instead of newest first (default: false)

Implementation Reference

  • src/index.ts:142-163 (registration)
    Tool registration: 'list_emails' is declared in the ListToolsRequestSchema handler with input schema (mailboxId, limit, ascending)
    {
      name: 'list_emails',
      description: 'List emails from a mailbox',
      inputSchema: {
        type: 'object',
        properties: {
          mailboxId: {
            type: 'string',
            description: 'ID of the mailbox to list emails from (optional, defaults to all)',
          },
          limit: {
            type: ['number', 'string'],
            description: 'Maximum number of emails to return (default: 20)',
            default: 20,
          },
          ascending: {
            type: 'boolean',
            description: 'Sort oldest first instead of newest first (default: false)',
          },
        },
      },
    },
  • Handler for 'list_emails' tool in the CallToolRequestSchema switch case. Extracts args (mailboxId, limit, ascending), validates limit, and calls client.getEmails()
    case 'list_emails': {
      const { mailboxId, limit, ascending } = args as any;
      const validLimit = Math.min(Math.max(Number(limit) || 20, 1), 100);
      const emails = await client.getEmails(mailboxId, validLimit, !!ascending);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(emails, null, 2),
          },
        ],
      };
    }
  • JmapClient.getEmails() - the actual JMAP API implementation that queries Email/query then Email/get via the Fastmail API
    }
    const trimmed = value.trim();
    // Date-only: 2026-04-18
    if (/^\d{4}-\d{2}-\d{2}$/.test(trimmed)) {
      const d = new Date(trimmed + 'T00:00:00Z');
      if (Number.isNaN(d.getTime())) throw new Error(`${fieldName} is not a valid date`);
      return trimmed.replace(/-/g, '');
    }
    // Datetime forms: floating, UTC (Z), or with offset (+/-HH:MM, +/-HHMM, +/-HH)
    const dtMatch = /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})(Z|[+-]\d{2}:?\d{0,2})?$/.exec(trimmed);
    if (!dtMatch) {
      throw new Error(`${fieldName} must be ISO-8601 date or datetime (got: ${trimmed.slice(0, 60)})`);
    }
    const [, datePart, timePart, tz] = dtMatch;
    const isoForParse = `${datePart}T${timePart}${tz || ''}`;
    const d = new Date(isoForParse);
    if (Number.isNaN(d.getTime())) {
      throw new Error(`${fieldName} is not a valid datetime`);
    }
    if (!tz) {
      // Floating: emit as-is without zone designator
      return `${datePart.replace(/-/g, '')}T${timePart.replace(/:/g, '')}`;
    }
    // UTC or offset: normalize to UTC instant
    const utc = d.toISOString().replace(/[-:]/g, '').replace(/\.\d{3}/, '');
Behavior2/5

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

No annotations are given, so the description must carry the burden of behavioral disclosure. It states 'list' (implying read-only) but does not explicitly confirm no side effects, mention rate limits, or describe pagination behavior. This is insufficient for a potentially large operation.

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

Conciseness3/5

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

The description is a single sentence, which is concise but minimal. It is appropriately sized for a simple list operation, but could be more informative without being verbose (e.g., mentioning result set structure).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is too brief. It does not clarify the return format (e.g., array of email objects), whether pagination is supported, or how sorting works beyond the 'ascending' param. For a list operation, more context is needed.

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% (all parameters documented), so baseline is 3. The description adds no extra meaning beyond what the schema already provides (e.g., mailboxId, limit, ascending defaults).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'List emails from a mailbox' is a clear verb+resource combination. It distinguishes from sibling tools like 'get_email' (single email) and 'search_emails' (filtered search), though it could be more specific about scope (e.g., listing all vs. filtered).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'search_emails' or 'get_recent_emails'. The description does not mention context, prerequisites, or when not to use it.

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/MadLlama25/fastmail-mcp'

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