Skip to main content
Glama
MadLlama25

Fastmail MCP Server

by MadLlama25

list_contacts

Retrieve a list of contacts from your Fastmail address book. Optionally set a maximum number of contacts to return.

Instructions

List contacts from the address book

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of contacts to return (default: 50)

Implementation Reference

  • src/index.ts:437-449 (registration)
    Tool 'list_contacts' is registered in the ListToolsRequestSchema handler with its input schema (limit param, default 50).
      name: 'list_contacts',
      description: 'List contacts from the address book',
      inputSchema: {
        type: 'object',
        properties: {
          limit: {
            type: 'number',
            description: 'Maximum number of contacts to return (default: 50)',
            default: 50,
          },
        },
      },
    },
  • Handler for 'list_contacts' tool: extracts limit from args (default 50), initializes ContactsCalendarClient, and calls getContacts(limit).
    case 'list_contacts': {
      const { limit = 50 } = args as any;
      const contactsClient = initializeContactsCalendarClient();
      const contacts = await contactsClient.getContacts(limit);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(contacts, null, 2),
          },
        ],
      };
    }
  • Actual implementation: checks contacts permission, then makes a JMAP request using ContactCard/query and ContactCard/get to fetch contacts from the Fastmail address book.
    async getContacts(limit: number = 50): Promise<any[]> {
      // Check permissions first
      const hasPermission = await this.checkContactsPermission();
      if (!hasPermission) {
        throw new Error('Contacts access not available. This account may not have JMAP contacts permissions enabled. Please check your Fastmail account settings or contact support to enable contacts API access.');
      }
    
      const session = await this.getSession();
      
      // Try CardDAV namespace first, then Fastmail specific
      const request: JmapRequest = {
        using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:contacts'],
        methodCalls: [
          ['ContactCard/query', {
            accountId: session.accountId,
            limit
          }, 'query'],
          ['ContactCard/get', {
            accountId: session.accountId,
            '#ids': { resultOf: 'query', name: 'ContactCard/query', path: '/ids' },
            properties: ['id', 'name', 'emails', 'phones', 'addresses', 'notes']
          }, 'contacts']
        ]
      };
    
      try {
        const response = await this.makeRequest(request);
        return this.getListResult(response, 1);
      } catch (error) {
        // Fallback: try to get contacts using AddressBook methods
        const fallbackRequest: JmapRequest = {
          using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:contacts'],
          methodCalls: [
            ['AddressBook/get', {
              accountId: session.accountId
            }, 'addressbooks']
          ]
        };
        
        try {
          const fallbackResponse = await this.makeRequest(fallbackRequest);
          return this.getListResult(fallbackResponse, 0);
        } catch (fallbackError) {
          throw new Error(`Contacts not supported or accessible: ${error instanceof Error ? error.message : String(error)}. Try checking account permissions or enabling contacts API access in Fastmail settings.`);
        }
      }
    }
Behavior2/5

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

No annotations provided, and the description does not disclose read-only nature, pagination behavior, or any side effects. Users are left guessing about output format and limitations.

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?

Extremely concise (one sentence) and front-loaded. However, it sacrifices necessary detail for brevity.

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

Completeness3/5

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

Given the simplicity (one optional parameter, no output schema), the description is minimally adequate. It fails to mention return format or pagination, leaving some gaps.

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% with a clear description for the 'limit' parameter. The tool description adds no additional meaning beyond the schema, warranting a baseline score.

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 states the action (list) and the resource (contacts from address book). It distinguishes from 'get_contact' (single) and 'search_contacts' (filtered), though it could better contrast with 'search_contacts'.

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 on when to use this tool versus alternatives like 'search_contacts'. The description does not specify prerequisites or context.

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