delete_inbox
Removes an email inbox and permanently deletes all its messages.
Instructions
Delete an inbox and all its messages
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inbox_id | Yes | Inbox ID to delete |
Implementation Reference
- mcp/index.js:259-268 (handler)MCP tool handler for 'delete_inbox'. Defines the tool with server.tool(), takes an inbox_id parameter, calls the REST API DELETE endpoint, and resets the default inbox cache on success.
server.tool( 'delete_inbox', 'Delete an inbox and all its messages', { inbox_id: idSchema.describe('Inbox ID to delete') }, async ({ inbox_id }) => { const result = await api('DELETE', `/v1/inboxes/${inbox_id}`); if (!result.error) _defaultInbox = null; // reset cache return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } ); - mcp/index.js:259-268 (registration)Tool registration using server.tool() with the name 'delete_inbox' and a Zod schema for inbox_id.
server.tool( 'delete_inbox', 'Delete an inbox and all its messages', { inbox_id: idSchema.describe('Inbox ID to delete') }, async ({ inbox_id }) => { const result = await api('DELETE', `/v1/inboxes/${inbox_id}`); if (!result.error) _defaultInbox = null; // reset cache return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } ); - mcp/index.js:262-262 (schema)Input schema for the delete_inbox tool: inbox_id (number or numeric string) validated by idSchema.
{ inbox_id: idSchema.describe('Inbox ID to delete') }, - src/db.js:233-237 (helper)Database-level deleteInbox function. Deletes all messages associated with the inbox, then deletes the inbox row itself, restricted by user_id.
export function deleteInbox(id, userId) { db.run('DELETE FROM emails WHERE inbox_id = ?', [id]); db.run('DELETE FROM inboxes WHERE id = ? AND user_id = ?', [id, userId]); saveDb(); } - src/index.js:143-152 (helper)REST API endpoint (DELETE /v1/inboxes/:id) that calls deleteInbox from db.js after verifying the inbox exists and belongs to the user.
app.delete('/v1/inboxes/:id', (req, res) => { try { const inbox = getInboxById(req.params.id, req.user.id); if (!inbox) return res.status(404).json({ error: 'Inbox not found' }); deleteInbox(req.params.id, req.user.id); res.json({ success: true }); } catch (err) { res.status(500).json({ error: err.message }); } });