check_inbox
List recent emails in a LobsterMail inbox to view sender, subject, and preview content for monitoring or processing messages.
Instructions
List recent emails in an inbox. Returns sender, subject, and preview for each email.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inbox_id | Yes | Inbox ID (e.g. ibx_...) | |
| limit | No | Max emails to return (default: 20) | |
| since | No | Only emails after this ISO 8601 timestamp |
Implementation Reference
- src/index.ts:64-94 (handler)Implementation of the 'check_inbox' MCP tool, which lists recent emails in an inbox.
server.registerTool('check_inbox', { title: 'Check Inbox', description: 'List recent emails in an inbox. Returns sender, subject, and preview for each email.', inputSchema: { inbox_id: z.string().describe('Inbox ID (e.g. ibx_...)'), limit: z.number().optional().describe('Max emails to return (default: 20)'), since: z.string().optional().describe('Only emails after this ISO 8601 timestamp'), }, }, async ({ inbox_id, limit, since }) => { const inbox = await getInbox(inbox_id); const emails = await inbox.receive({ limit, since }); if (emails.length === 0) { return { content: [{ type: 'text' as const, text: 'No emails found in this inbox.' }] }; } const lines = emails.map( (e) => `- [${e.id}] From: ${e.from} | Subject: ${e.subject} | ${e.createdAt}` + (e.isInjectionRisk ? ' ⚠️ INJECTION RISK' : ''), ); return { content: [ { type: 'text' as const, text: `${emails.length} email(s) found:\n\n${lines.join('\n')}\n\nUse get_email with an email_id to read the full body.`, }, ], }; });