get_email_attachments
Retrieve a list of file attachments from a specific Fastmail email using its unique identifier.
Instructions
Get list of attachments for an email
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| emailId | Yes | ID of the email |
Implementation Reference
- src/jmap-client.ts:426-443 (handler)Core handler function that executes the tool logic by making a JMAP Email/get request to retrieve attachments for the specified email ID.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 = response.methodResponses[0][1].list[0]; return email?.attachments || []; }
- src/index.ts:453-464 (schema)Defines the input schema and metadata for the MCP tool, specifying that it requires an '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:970-985 (registration)MCP server request handler case that dispatches the tool call, validates input, invokes the JmapClient handler, and formats the response.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), }, ], }; }
- src/index.ts:452-465 (registration)Tool registration entry in the MCP server's tools list, including name, description, and schema.{ 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'], }, },