Skip to main content
Glama
jgottlieb84

agentline-mcp

by jgottlieb84

wait_for_email

Long-poll for inbound email on a provisioned address. Trigger after sending an email (e.g., signup verification). Optionally match body text with regex. Returns subject, body_text, extracted_code on match, or timeout status.

Instructions

Long-poll (blocking up to timeout seconds, max 180) for the next inbound email on a provisioned address. Use right after triggering an email (e.g. a 'check your email' signup step).

match is an optional regex run against the message body. Returns the message dict on match (includes subject, body_text, extracted_code), or {"message": null, "status": "timeout"} on timeout.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
email_addressYes
timeoutNo
matchNo

Implementation Reference

  • The `wait_for_email` tool handler — decorated with @mcp.tool(), long-polls for the next inbound email on a provisioned address. Accepts `email_address`, `timeout`, and optional `match` regex. Calls the Agentline SDK's `wait_for_email()`, returns message dict or timeout.
    @mcp.tool()
    def wait_for_email(
        email_address: str,
        timeout: float = DEFAULT_WAIT_TIMEOUT,
        match: str | None = None,
    ) -> dict:
        """Long-poll (blocking up to `timeout` seconds, max 180) for the next
        inbound email on a provisioned address. Use right after triggering an email
        (e.g. a 'check your email' signup step).
    
        `match` is an optional regex run against the message body. Returns the
        message dict on match (includes `subject`, `body_text`, `extracted_code`),
        or `{"message": null, "status": "timeout"}` on timeout.
        """
        try:
            msg = _client_or_init().wait_for_email(
                email_address=email_address,
                timeout=_clamp_timeout(timeout),
                match=match,
            )
            if msg is None:
                return {"message": None, "status": "timeout"}
            return {"message": asdict(msg), "status": "received"}
        except AgentlineError as e:
            return {"error": str(e), "status_code": e.status_code}
  • Registration of `wait_for_email` as an MCP tool via the `@mcp.tool()` decorator on line 328.
    @mcp.tool()
    def wait_for_email(
  • The function signature defines the input schema: `email_address: str`, `timeout: float` (default 60.0), `match: str | None`. Return type is `dict`.
    def wait_for_email(
        email_address: str,
        timeout: float = DEFAULT_WAIT_TIMEOUT,
        match: str | None = None,
    ) -> dict:
  • Helper function `_clamp_timeout` used to clamp the timeout parameter to [1.0, MAX_WAIT_TIMEOUT=180.0].
    def _clamp_timeout(timeout: float) -> float:
        return max(1.0, min(float(timeout), MAX_WAIT_TIMEOUT))
  • Constants `DEFAULT_WAIT_TIMEOUT` (60.0) and `MAX_WAIT_TIMEOUT` (180.0) used by the `wait_for_email` tool.
    DEFAULT_WAIT_TIMEOUT = 60.0
    MAX_WAIT_TIMEOUT = 180.0
Behavior5/5

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

With no annotations, the description fully discloses blocking behavior (up to 180 seconds), timeout response format, and optional regex matching. This provides complete behavioral transparency.

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?

Two paragraph structure with front-loaded purpose and usage, followed by parameter and return details. Every sentence is informative and necessary.

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

Completeness5/5

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

Given no output schema and 3 parameters, the description covers blocking behavior, timeout, regex, and return format. It is self-contained and complete for selecting and invoking the tool.

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

Parameters5/5

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

Despite 0% schema coverage, the description explains the 'timeout' default and max, the 'match' regex functionality, and implicitly the email_address role. This adds significant meaning beyond the schema structure.

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?

The description clearly states it 'long-polls for the next inbound email on a provisioned address,' using specific verbs and resource. It distinguishes from sibling tools like wait_for_sms and list_email_addresses.

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

Usage Guidelines4/5

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

Explicitly says 'Use right after triggering an email (e.g. a 'check your email' signup step),' providing clear context. Does not mention when not to use or alternatives, but siblings are available.

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/jgottlieb84/agentline-mcp'

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