get-email
Retrieve a specific email by its ID using MCP server integration. Ideal for accessing targeted email data within the Meme MCP Server ecosystem.
Instructions
Get a specific email by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| emailId | Yes | The ID of the email to retrieve |
Implementation Reference
- src/tools.ts:164-201 (registration)Full registration of the 'get-email' tool, including schema (emailId: string) and inline handler that executes Composio's GMAIL_GET_EMAIL action to retrieve and display email details.server.tool("get-email", "Get a specific email by ID", { emailId: z.string().describe("The ID of the email to retrieve"), }, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_GET_EMAIL", entityId: userAddress, params: args }); if (result.successful) { const email = result.data?.response_data as any; return { content: [{ type: "text", text: `📧 Email Details:\n\nFrom: ${email.payload?.headers?.find((h: any) => h.name === 'From')?.value}\nSubject: ${email.payload?.headers?.find((h: any) => h.name === 'Subject')?.value}\nDate: ${email.payload?.headers?.find((h: any) => h.name === 'Date')?.value}\n\nBody: ${email.snippet}` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to get email: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error getting email:', error); return { content: [{ type: "text", text: `Error getting email: ${error instanceof Error ? error.message : String(error)}` }], }; } });
- src/tools.ts:166-201 (handler)The handler function for 'get-email' tool. It uses VercelAIToolSet's executeAction with 'GMAIL_GET_EMAIL' to fetch the email by ID and returns formatted details including From, Subject, Date, and snippet.}, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_GET_EMAIL", entityId: userAddress, params: args }); if (result.successful) { const email = result.data?.response_data as any; return { content: [{ type: "text", text: `📧 Email Details:\n\nFrom: ${email.payload?.headers?.find((h: any) => h.name === 'From')?.value}\nSubject: ${email.payload?.headers?.find((h: any) => h.name === 'Subject')?.value}\nDate: ${email.payload?.headers?.find((h: any) => h.name === 'Date')?.value}\n\nBody: ${email.snippet}` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to get email: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error getting email:', error); return { content: [{ type: "text", text: `Error getting email: ${error instanceof Error ? error.message : String(error)}` }], }; } });
- src/tools.ts:164-165 (schema)Input schema for 'get-email' tool: requires 'emailId' as a string.server.tool("get-email", "Get a specific email by ID", { emailId: z.string().describe("The ID of the email to retrieve"),