Skip to main content
Glama
owen-nash

Fastmail MCP Server

by owen-nash

get_email_attachments

Retrieve a list of attachments from a specified email using its ID.

Instructions

Get list of attachments for an email

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailIdYesID of the email

Implementation Reference

  • The actual implementation of getEmailAttachments on the JmapClient class. It makes a JMAP Email/get call requesting only the 'attachments' property and returns the attachment list.
    async getEmailAttachments(emailId: string): Promise<any[]> {
      const session = await this.getSession();
    
      const request: JmapRequest = {
        using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'],
        methodCalls: [
          ['Email/get', {
            accountId: session.accountId,
            ids: [emailId],
            properties: ['attachments']
          }, 'getAttachments']
        ]
      };
    
      const response = await this.makeRequest(request);
      const email = this.getListResult(response, 0)[0];
      return email?.attachments || [];
    }
  • The CallToolRequestSchema handler that routes 'get_email_attachments' to the JmapClient.getEmailAttachments method.
    case 'get_email_attachments': {
      const { emailId } = args as any;
      if (!emailId) {
        throw new McpError(ErrorCode.InvalidParams, 'emailId is required');
      }
      const client = initializeClient();
      const attachments = await client.getEmailAttachments(emailId);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(attachments, null, 2),
          },
        ],
      };
    }
  • Tool registration with input schema for get_email_attachments. Requires a single 'emailId' string parameter.
    {
      name: 'get_email_attachments',
      description: 'Get list of attachments for an email',
      inputSchema: {
        type: 'object',
        properties: {
          emailId: {
            type: 'string',
            description: 'ID of the email',
          },
        },
        required: ['emailId'],
      },
    },
  • src/index.ts:718-731 (registration)
    Registration of the 'get_email_attachments' tool in the ListToolsRequestSchema handler.
    {
      name: 'get_email_attachments',
      description: 'Get list of attachments for an email',
      inputSchema: {
        type: 'object',
        properties: {
          emailId: {
            type: 'string',
            description: 'ID of the email',
          },
        },
        required: ['emailId'],
      },
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It does not mention any behavioral traits such as whether the list includes metadata, file sizes, or content types, nor any side effects or permissions needed.

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?

The description is a single, focused sentence with no extraneous words, making it highly concise and well-structured for quick comprehension.

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, the description fails to specify what the list contains (e.g., attachment IDs, names, sizes), and provides no information on error conditions or authentication requirements, leaving the agent with incomplete context for invoking the tool.

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 parameter 'emailId' is fully described in the input schema (100% coverage). The description adds no additional meaning beyond what the schema provides, meeting the baseline for full coverage.

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 clearly states the action ('Get list'), the resource ('attachments'), and the scope ('for an email'), distinguishing it from siblings like 'download_attachment' (which downloads a specific attachment) and 'get_email' (which retrieves email content).

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?

The description provides no guidance on when to use this tool versus alternatives like 'download_attachment', no prerequisites (e.g., email existence), and no mention of what not to use it for.

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