mark-as-unread
Mark emails as unread to return them to your inbox for later review. Use this tool to manage email visibility by specifying email IDs.
Instructions
Mark emails as unread
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| emailIds | Yes | Array of email IDs to mark as unread |
Implementation Reference
- src/tools.ts:572-608 (registration)Registration of the 'mark-as-unread' MCP tool using server.tool, including description, Zod input schema, and inline async handler function.server.tool("mark-as-unread", "Mark emails as unread", { emailIds: z.array(z.string()).describe("Array of email IDs to mark as unread"), }, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_MARK_AS_UNREAD", entityId: userAddress, params: args }); if (result.successful) { return { content: [{ type: "text", text: `✅ Emails marked as unread successfully!\n\nMarked ${args.emailIds.length} email(s) as unread.` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to mark emails as unread: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error marking emails as unread:', error); return { content: [{ type: "text", text: `Error marking emails as unread: ${error instanceof Error ? error.message : String(error)}` }], }; } });
- src/tools.ts:574-607 (handler)The core handler function for executing the 'mark-as-unread' tool. It uses VercelAIToolSet's executeAction to perform 'GMAIL_MARK_AS_UNREAD' with the provided emailIds, handles success/error responses, and returns formatted text content.}, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_MARK_AS_UNREAD", entityId: userAddress, params: args }); if (result.successful) { return { content: [{ type: "text", text: `✅ Emails marked as unread successfully!\n\nMarked ${args.emailIds.length} email(s) as unread.` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to mark emails as unread: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error marking emails as unread:', error); return { content: [{ type: "text", text: `Error marking emails as unread: ${error instanceof Error ? error.message : String(error)}` }], }; }
- src/tools.ts:573-573 (schema)Zod schema defining the input parameters for the tool: an array of string email IDs.emailIds: z.array(z.string()).describe("Array of email IDs to mark as unread"),