mailosaur_messages_delete
Delete a message and its attachments permanently by providing the message ID. Requires confirmation to complete removal.
Instructions
Permanently delete a message and its attachments.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Message ID. | |
| confirm | No |
Implementation Reference
- src/index.ts:224-236 (registration)Registration of the 'mailosaur_messages_delete' tool on the MCP server using server.tool().
server.tool( "mailosaur_messages_delete", "Permanently delete a message and its attachments.", { id: z.string().describe("Message ID."), confirm: z.boolean().optional() }, async ({ id, confirm }) => { requireConfirm(confirm, `delete message ${id}`); await mailosaur.messages.del(id); return emptyResponse("Message deleted."); } ); - src/index.ts:231-235 (handler)Handler function for mailosaur_messages_delete: accepts id and confirm parameters, calls requireConfirm to enforce confirmation, then deletes the message via mailosaur.messages.del().
async ({ id, confirm }) => { requireConfirm(confirm, `delete message ${id}`); await mailosaur.messages.del(id); return emptyResponse("Message deleted."); } - src/index.ts:227-230 (schema)Input schema for the tool: id (string) and optional confirm (boolean).
{ id: z.string().describe("Message ID."), confirm: z.boolean().optional() }, - src/index.ts:94-98 (helper)Helper function requireConfirm: throws an error unless confirm is truthy, used by destructive tools like mailosaur_messages_delete.
function requireConfirm(confirm: boolean | undefined, action: string) { if (!confirm) { throw new Error(`Refusing to ${action}. Call again with confirm: true.`); } } - src/index.ts:90-92 (helper)Helper function emptyResponse: returns a standardized success response object, used by the tool to confirm deletion.
function emptyResponse(message = "OK") { return response({ ok: true, message }); }