wait_for_email
Monitor an inbox for incoming emails using real-time server-side polling. Returns matching emails in LLM-safe format when they arrive, with optional filters for sender, subject, and timeout.
Instructions
Wait for an incoming email matching optional filters. Returns near-instantly when an email arrives (real-time server-side long-polling). Returns the email body in LLM-safe format.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inbox_id | Yes | Inbox ID (e.g. ibx_...) | |
| from | No | Filter by sender address | |
| subject | No | Filter by subject (substring match) | |
| timeout | No | Max wait time in milliseconds (default: 60000, max: 120000) |
Implementation Reference
- src/index.ts:113-120 (handler)The tool handler for wait_for_email, which calls inbox.waitForEmail.
}, async ({ inbox_id, from, subject, timeout }) => { const inbox = await getInbox(inbox_id); const effectiveTimeout = Math.min(timeout ?? 60_000, 120_000); const email = await inbox.waitForEmail({ filter: { from, subject }, timeout: effectiveTimeout, }); - src/index.ts:98-113 (registration)The registration of the wait_for_email tool, including its schema and metadata.
server.registerTool('wait_for_email', { title: 'Wait for Email', description: 'Wait for an incoming email matching optional filters. ' + 'Returns near-instantly when an email arrives (real-time server-side long-polling). ' + 'Returns the email body in LLM-safe format.', inputSchema: { inbox_id: z.string().describe('Inbox ID (e.g. ibx_...)'), from: z.string().optional().describe('Filter by sender address'), subject: z.string().optional().describe('Filter by subject (substring match)'), timeout: z .number() .optional() .describe('Max wait time in milliseconds (default: 60000, max: 120000)'), }, }, async ({ inbox_id, from, subject, timeout }) => {