Skip to main content
Glama
owen-nash

Fastmail MCP Server

by owen-nash

list_emails

Fetch emails from a mailbox, with optional parameters to specify mailbox ID, limit number of results, and sort by 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:146-166 (registration)
    Registration of the 'list_emails' tool: defines the tool name, description, and 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': extracts args (mailboxId, limit, ascending), clamps limit between 1-100, 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),
          },
        ],
      };
    }
  • The JmapClient.getEmails() method: builds JMAP Email/query and Email/get requests filtering by mailboxId, sorting by receivedAt, respecting limit/ascending, and returning email metadata.
    async getEmails(mailboxId?: string, limit: number = 20, ascending: boolean = false): Promise<any[]> {
      const session = await this.getSession();
    
      const filter = mailboxId ? { inMailbox: mailboxId } : {};
    
      const request: JmapRequest = {
        using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'],
        methodCalls: [
          ['Email/query', {
            accountId: session.accountId,
            filter,
            sort: [{ property: 'receivedAt', isAscending: ascending }],
            limit
          }, 'query'],
          ['Email/get', {
            accountId: session.accountId,
            '#ids': { resultOf: 'query', name: 'Email/query', path: '/ids' },
            properties: ['id', 'subject', 'from', 'to', 'replyTo', 'receivedAt', 'preview', 'hasAttachment']
          }, 'emails']
        ]
      };
    
      const response = await this.makeRequest(request);
      return this.getListResult(response, 1);
    }
Behavior2/5

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

With no annotations, the description carries full burden but only states the basic action. It does not disclose whether the operation is read-only, what data is returned, or any constraints like pagination. Minimal behavioral context.

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

Conciseness4/5

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

The description is a single concise sentence with no redundancy. However, it could be slightly more informative while remaining concise.

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 the lack of output schema and annotations, the description is too brief. It fails to specify the return format, field details, or pagination behavior, leaving the agent underinformed.

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%, so the description adds limited value beyond the existing parameter descriptions. It restates defaults and optionality, but no deeper semantics.

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?

Description clearly states the verb and resource ('List emails from a mailbox'), but does not differentiate from sibling tools like search_emails or get_recent_emails, which have similar purposes.

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. It lacks explicit context, exclusions, or mentions of prerequisites.

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

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