mark-as-read
Automatically mark specific emails as read by providing their IDs. This tool simplifies email management, helping users prioritize and organize their inbox efficiently.
Instructions
Mark emails as read
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| emailIds | Yes | Array of email IDs to mark as read |
Implementation Reference
- src/tools.ts:536-570 (handler)The handler function that implements the core logic of the 'mark-as-read' tool. It uses the Composio toolset to execute the 'GMAIL_MARK_AS_READ' action with the provided emailIds and returns formatted success or error messages.}, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_MARK_AS_READ", entityId: userAddress, params: args }); if (result.successful) { return { content: [{ type: "text", text: `✅ Emails marked as read successfully!\n\nMarked ${args.emailIds.length} email(s) as read.` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to mark emails as read: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error marking emails as read:', error); return { content: [{ type: "text", text: `Error marking emails as read: ${error instanceof Error ? error.message : String(error)}` }], }; } });
- src/tools.ts:535-535 (schema)Zod schema defining the input parameters for the 'mark-as-read' tool, specifically an array of email ID strings.emailIds: z.array(z.string()).describe("Array of email IDs to mark as read"),
- src/tools.ts:534-570 (registration)The server.tool registration call for the 'mark-as-read' tool, specifying name, description, input schema, and the handler function.server.tool("mark-as-read", "Mark emails as read", { emailIds: z.array(z.string()).describe("Array of email IDs to mark as read"), }, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_MARK_AS_READ", entityId: userAddress, params: args }); if (result.successful) { return { content: [{ type: "text", text: `✅ Emails marked as read successfully!\n\nMarked ${args.emailIds.length} email(s) as read.` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to mark emails as read: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error marking emails as read:', error); return { content: [{ type: "text", text: `Error marking emails as read: ${error instanceof Error ? error.message : String(error)}` }], }; } });