get_email_attachments
List attachments on an email to obtain their IDs, enabling targeted download of specific files.
Instructions
List the attachments on a specific email. Use after get_email when you need attachment IDs before downloading one. Do not use to download content directly; use download_attachment.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| emailId | Yes | ID of the email |
Implementation Reference
- src/jmap-client.ts:876-893 (handler)The JMAP client method that fetches attachments for a given email by calling Email/get with the 'attachments' property and returning the attachments array.
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 || []; } - src/mcp-server.ts:320-325 (handler)The MCP server handler that processes the 'get_email_attachments' tool call, validates the emailId parameter, invokes the client, and returns the attachments as JSON.
case 'get_email_attachments': { const { emailId } = args as any; if (!emailId) throw new McpError(ErrorCode.InvalidParams, 'emailId is required'); const attachments = await client.getEmailAttachments(emailId); return { content: [{ type: 'text', text: JSON.stringify(attachments, null, 2) }] }; } - src/tool-definitions.ts:550-568 (schema)The tool definition/schema for 'get_email_attachments', declaring its input (emailId) and description/usage hints.
readTool( 'get_email_attachments', 'Get Email Attachments', description( 'List the attachments on a specific email.', 'Use after get_email when you need attachment IDs before downloading one.', 'Do not use to download content directly; use download_attachment.', ), { type: 'object', properties: { emailId: { type: 'string', description: 'ID of the email', }, }, required: ['emailId'], }, ), - src/mcp-server.ts:415-418 (registration)Registration of 'get_email_attachments' in the list of available email functions reported by the 'check_function_availability' handler.
'get_email_attachments', 'download_attachment', 'advanced_search', 'get_thread', 'get_mailbox_stats', 'get_account_summary', 'bulk_mark_read', 'bulk_move', 'bulk_delete', 'add_labels', 'remove_labels', 'bulk_add_labels', 'bulk_remove_labels', ],