Skip to main content
Glama
owen-nash

Fastmail MCP Server

by owen-nash

check_function_availability

Verify which MCP functions your Fastmail account permissions allow. Avoid errors by checking availability before making requests.

Instructions

Check which MCP functions are available based on account permissions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:961-968 (registration)
    Tool registration in the ListToolsRequestSchema handler. Defines the tool name, description, and input schema (no parameters required).
    {
      name: 'check_function_availability',
      description: 'Check which MCP functions are available based on account permissions',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Handler for check_function_availability. Fetches the JMAP session, checks capabilities for contacts and calendars, and returns a structured availability object listing all MCP functions grouped by category (email, identity, contacts, calendar) with enablement guides for unavailable features.
    case 'check_function_availability': {
      const client = initializeClient();
      const session = await client.getSession();
      
      const availability = {
        email: {
          available: true,
          functions: [
            'list_mailboxes', 'list_emails', 'get_email', 'send_email', 'create_draft', 'edit_draft', 'send_draft', 'search_emails',
            'get_recent_emails', 'mark_email_read', 'pin_email', 'delete_email', 'move_email',
            'get_email_attachments', 'download_attachment', 'advanced_search', 'get_thread',
            'get_mailbox_stats', 'get_account_summary', 'bulk_mark_read', 'bulk_pin', 'bulk_move', 'bulk_delete',
            'add_labels', 'remove_labels', 'bulk_add_labels', 'bulk_remove_labels'
          ]
        },
        identity: {
          available: true,
          functions: ['list_identities']
        },
        contacts: {
          available: !!session.capabilities['urn:ietf:params:jmap:contacts'],
          functions: ['list_contacts', 'get_contact', 'search_contacts'],
          note: session.capabilities['urn:ietf:params:jmap:contacts'] ? 
            'Contacts are available' : 
            'Contacts access not available - may require enabling in Fastmail account settings',
          enablementGuide: session.capabilities['urn:ietf:params:jmap:contacts'] ? null : {
            steps: [
              '1. Log into Fastmail web interface',
              '2. Go to Settings → Privacy & Security → Connected Apps & API tokens',
              '3. Check if contacts scope is enabled for your API token',
              '4. If not available, you may need to upgrade your Fastmail plan or contact support'
            ],
            documentation: 'https://www.fastmail.com/help/technical/jmap-api.html'
          }
        },
        calendar: {
          available: !!session.capabilities['urn:ietf:params:jmap:calendars'],
          functions: ['list_calendars', 'list_calendar_events', 'get_calendar_event', 'create_calendar_event'],
          note: session.capabilities['urn:ietf:params:jmap:calendars'] ? 
            'Calendar is available' : 
            'Calendar access not available - may require enabling in Fastmail account settings',
          enablementGuide: session.capabilities['urn:ietf:params:jmap:calendars'] ? null : {
            steps: [
              '1. Log into Fastmail web interface',
              '2. Go to Settings → Privacy & Security → Connected Apps & API tokens',
              '3. Check if calendar scope is enabled for your API token',
              '4. If not available, you may need to upgrade your Fastmail plan or contact support'
            ],
            documentation: 'https://www.fastmail.com/help/technical/jmap-api.html'
          }
        },
        capabilities: Object.keys(session.capabilities)
      };
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(availability, null, 2),
          },
        ],
      };
    }
  • The getSession() helper method on JmapClient. Fetches the JMAP session from the server, validates URLs, extracts capabilities (used by check_function_availability to determine contacts and calendar availability), and caches the result.
    async getSession(): Promise<JmapSession> {
      if (this.session) {
        return this.session;
      }
    
      const response = await fetch(this.auth.getSessionUrl(), {
        method: 'GET',
        headers: this.auth.getAuthHeaders()
      });
    
      if (!response.ok) {
        throw new Error(`Failed to get session: ${response.statusText}`);
      }
    
      const sessionData = await response.json() as any;
    
      // Validate every URL the server hands us before we send the bearer token to it.
      // The downloadUrl/uploadUrl are URL templates with {accountId}/{blobId}/etc.
      // placeholders, so we strip those for parsing and validate origin only.
      const allowUnsafe = this.auth.getAllowUnsafe();
      const stripTemplate = (url: string) => url.replace(/\{[^}]+\}/g, 'x');
      if (typeof sessionData.apiUrl !== 'string') {
        throw new Error('Invalid session response: apiUrl missing');
      }
      validateFastmailUrl(sessionData.apiUrl, 'session.apiUrl', allowUnsafe);
      if (typeof sessionData.downloadUrl === 'string') {
        validateFastmailUrl(stripTemplate(sessionData.downloadUrl), 'session.downloadUrl', allowUnsafe);
      }
      if (typeof sessionData.uploadUrl === 'string') {
        validateFastmailUrl(stripTemplate(sessionData.uploadUrl), 'session.uploadUrl', allowUnsafe);
      }
    
      this.session = {
        apiUrl: sessionData.apiUrl,
        accountId: sessionData.primaryAccounts?.['urn:ietf:params:jmap:mail']
          || sessionData.primaryAccounts?.['urn:ietf:params:jmap:core']
          || Object.keys(sessionData.accounts)[0],
        capabilities: sessionData.capabilities,
        downloadUrl: sessionData.downloadUrl,
        uploadUrl: sessionData.uploadUrl
      };
    
      return this.session;
    }
Behavior2/5

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

No annotations provided. The description only mentions the purpose but not behavioral traits like read-only nature, idempotency, or error handling, leaving the agent to infer.

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?

Single sentence, direct and no unnecessary words.

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?

Adequate for a simple tool with no parameters and no output schema, but could hint at return format or behavior when no functions are available.

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

Parameters4/5

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

No parameters, so baseline 4 applies. The description adds no additional parameter info, which is acceptable.

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 tool checks which MCP functions are available based on permissions, distinguishing it from action-oriented siblings. However, 'MCP functions' is slightly vague without context.

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, prerequisites, or typical usage scenarios.

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