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
| Name | Required | Description | Default |
|---|---|---|---|
| emailId | Yes | ID of the email |
Implementation Reference
- src/jmap-client.ts:1006-1023 (handler)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 || []; } - src/index.ts:1515-1530 (handler)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), }, ], }; } - src/index.ts:718-731 (schema)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'], }, },