Skip to main content
Glama
MadLlama25

Fastmail MCP Server

by MadLlama25

check_function_availability

Check available MCP functions based on your Fastmail account permissions, helping you know which operations you can perform.

Instructions

Check which MCP functions are available based on account permissions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:959-965 (registration)
    Tool 'check_function_availability' is registered in the ListToolsRequestSchema handler with its description and input schema.
      name: 'check_function_availability',
      description: 'Check which MCP functions are available based on account permissions',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Handler for the 'check_function_availability' tool in the CallToolRequestSchema switch statement. It calls client.getSession() to examine JMAP session capabilities and returns a JSON report on which function categories (email, identity, contacts, calendar) are available, including guidance for enabling missing 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),
          },
        ],
      };
    }
  • getSession() method on JmapClient fetches the JMAP session from the server, validates URLs, and returns session data including capabilities used by the handler.
    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;
    }
Behavior3/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It states the tool checks availability based on permissions, but does not explicitly confirm it is read-only, non-destructive, or how it handles errors. Minimal but adequate.

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?

A single sentence that is efficient and front-loaded with the verb and resource. Every word earns its place; no redundancy or filler.

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

Completeness5/5

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

Given no parameters, no output schema, and no annotations, the description fully covers the tool's purpose and behavior. It is complete for a simple check tool.

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?

There are zero parameters, and schema coverage is 100% (empty). The description adds meaning by explaining what the tool returns (which functions are available). Baseline for 0 params is 4, and description meets that.

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

Purpose5/5

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

The description uses a specific verb 'Check' and resource 'MCP functions available', clearly distinguishing it from sibling tools that perform actual operations (e.g., send_email, list_emails). It also specifies the basis 'based on account permissions', making the tool's purpose unambiguous.

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

Usage Guidelines3/5

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

The description implies usage for verifying available functions before performing operations, but it does not explicitly state when to use this tool versus alternatives or provide any exclusions. No guidance on prerequisites or typical use cases.

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