wait_for_email
Monitor an inbox for incoming emails and return them upon arrival. Set a timeout to control how long to wait for email delivery.
Instructions
Poll an inbox until an email arrives. Returns the email once received. Times out after the specified duration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inbox_id | Yes | The inbox ID to wait on | |
| timeout_seconds | No | Max seconds to wait (default: 60, max: 300) |
Implementation Reference
- mcp-server/src/index.ts:146-175 (handler)The actual implementation of the "wait_for_email" tool handler, which polls an inbox for new emails.
async ({ inbox_id, timeout_seconds }) => { const timeout = Math.min(timeout_seconds ?? 60, 300); const deadline = Date.now() + timeout * 1000; const interval = 2000; while (Date.now() < deadline) { const result = (await blipFetch(`/v1/inboxes/${inbox_id}`)) as { emails?: { id: string }[]; }; if (result?.emails && result.emails.length > 0) { // Return the full detail of the most recent email const email = await blipFetch(`/v1/emails/${result.emails[0].id}`); return { content: [{ type: "text", text: JSON.stringify(email, null, 2) }], }; } await new Promise((resolve) => setTimeout(resolve, interval)); } return { content: [ { type: "text", text: `No email received in inbox ${inbox_id} after ${timeout} seconds.`, }, ], }; } - mcp-server/src/index.ts:136-145 (registration)Registration and schema definition for the "wait_for_email" tool.
server.tool( "wait_for_email", "Poll an inbox until an email arrives. Returns the email once received. Times out after the specified duration.", { inbox_id: z.string().describe("The inbox ID to wait on"), timeout_seconds: z .number() .optional() .describe("Max seconds to wait (default: 60, max: 300)"), },