Skip to main content
Glama

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
NameRequiredDescriptionDefault
inbox_idYesThe inbox ID to wait on
timeout_secondsNoMax seconds to wait (default: 60, max: 300)

Implementation Reference

  • 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.`,
          },
        ],
      };
    }
  • 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)"),
      },
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. Discloses critical polling behavior, return timing, and timeout mechanism. Missing timeout failure mode (returns null vs error?) and polling interval details, but covers core operational traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences with zero waste. Front-loaded with core action (poll), followed by output and constraints. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists; description states 'Returns the email' but lacks structural details of returned object. Without annotations and given waiting-tool complexity, should specify timeout failure behavior and return format.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with detailed descriptions (timeout_seconds includes defaults/limits). Description mentions 'specified duration' reinforcing timeout_seconds, but adds no semantic details beyond schema for inbox_id.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear specific action: 'Poll an inbox until an email arrives' distinguishes from siblings like read_email (which reads existing) and get_inbox (which gets metadata). Includes return value and timeout behavior.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies usage through 'poll until email arrives' (use when expecting new mail), but lacks explicit comparison to siblings like read_email or guidance on when to prefer immediate fetching vs waiting.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/blipemail/blip'

If you have feedback or need assistance with the MCP directory API, please join our Discord server