Skip to main content
Glama
MadLlama25

Fastmail MCP Server

by MadLlama25

get_recent_emails

Retrieve the most recent emails from your Fastmail inbox or specified mailbox. Control the number of emails returned and sort order to quickly access recent correspondence.

Instructions

Get the most recent emails from inbox (like top-ten)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of recent emails to retrieve (default: 10, max: 50)
mailboxNameNoMailbox to search (default: inbox)inbox
ascendingNoSort oldest first instead of newest first (default: false)

Implementation Reference

  • The actual implementation of get_recent_emails in JmapClient class. Calls JMAP API to find the target mailbox by role/name, then queries emails sorted by receivedAt, returning id/subject/from/to/replyTo/receivedAt/preview/hasAttachment/keywords/List-Unsubscribe.
    async getRecentEmails(limit: number = 10, mailboxName: string = 'inbox', ascending: boolean = false): Promise<any[]> {
      const session = await this.getSession();
      
      // Find the specified mailbox (default to inbox)
      const mailboxes = await this.getMailboxes();
      const targetMailbox = mailboxes.find(mb => 
        mb.role === mailboxName.toLowerCase() || 
        mb.name.toLowerCase().includes(mailboxName.toLowerCase())
      );
      
      if (!targetMailbox) {
        throw new Error(`Could not find mailbox: ${mailboxName}`);
      }
    
      const request: JmapRequest = {
        using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'],
        methodCalls: [
          ['Email/query', {
            accountId: session.accountId,
            filter: { inMailbox: targetMailbox.id },
            sort: [{ property: 'receivedAt', isAscending: ascending }],
            limit: Math.min(limit, 50)
          }, 'query'],
          ['Email/get', {
            accountId: session.accountId,
            '#ids': { resultOf: 'query', name: 'Email/query', path: '/ids' },
            properties: ['id', 'subject', 'from', 'to', 'replyTo', 'receivedAt', 'preview', 'hasAttachment', 'keywords', 'header:List-Unsubscribe:asURLs']
          }, 'emails']
        ]
      };
    
      const response = await this.makeRequest(request);
      return this.getListResult(response, 1);
    }
  • Schema definition for the get_recent_emails tool, defining input parameters: limit (number/string, default 10, max 50), mailboxName (string, default 'inbox'), ascending (boolean, default false).
    name: 'get_recent_emails',
    description: 'Get the most recent emails from inbox (like top-ten)',
    inputSchema: {
      type: 'object',
      properties: {
        limit: {
          type: ['number', 'string'],
          description: 'Number of recent emails to retrieve (default: 10, max: 50)',
          default: 10,
        },
        mailboxName: {
          type: 'string',
          description: 'Mailbox to search (default: inbox)',
          default: 'inbox',
        },
        ascending: {
          type: 'boolean',
          description: 'Sort oldest first instead of newest first (default: false)',
        },
      },
    },
  • src/index.ts:1390-1402 (registration)
    Registration/handler dispatch for get_recent_emails in the CallToolRequestSchema handler. Extracts args (limit, mailboxName, ascending), calls client.getRecentEmails(), and returns JSON result.
    case 'get_recent_emails': {
      const { limit = 10, mailboxName = 'inbox', ascending } = args as any;
      const client = initializeClient();
      const emails = await client.getRecentEmails(limit, mailboxName, !!ascending);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(emails, null, 2),
          },
        ],
      };
    }
Behavior2/5

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

No annotations exist, so the description must disclose behavioral traits. It mentions 'most recent emails' implying a sort order, but it does not state that it only accesses the specified mailbox (default inbox), that it can sort ascending, or that it has no side effects. Important behaviors like mutability or read-only status are left unaddressed.

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 one sentence and very concise. The colloquial 'like top-ten' is informal but still clear. No unnecessary words. Slightly more structure could improve readability.

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 tool has three parameters, no output schema, and no annotations, the description is too brief. It does not explain the return format, pagination, or how it handles multiple mailboxes. For a tool with many siblings, more context is needed to ensure correct invocation.

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?

The input schema covers 100% of the parameters with descriptions. The description adds slight context about 'most recent' and 'top-ten' hinting at limit and sort, but does not provide new semantic value beyond the schema. Baseline 3 is appropriate.

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 clearly identifies the verb (Get) and resource (recent emails from inbox). The phrase '(like top-ten)' adds specificity about the scope. However, it does not explicitly differentiate from sibling tools such as list_emails or search_emails.

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, list_emails, or get_email. With many sibling tools, this omission makes it harder for an agent to select the correct tool.

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