Skip to main content
Glama

wait_for_otp

Read-only

Block until an OTP arrives in an inbox and return it, so you can complete signup or login without polling email or writing regex.

Instructions

Block (bounded) until an OTP arrives in inbox_id and return it.

This is the headline tool: use it right after triggering a signup/login
email so you never have to write a polling loop or regex over an email
body. Call it with the ``id`` returned by ``create_inbox``.

``timeout`` is requested in seconds but always clamped to [1, max], where
max is 120 for the local stdio server and 55 for the remote HTTP server:
this is the requested overall wait deadline the SDK aims for, not a hard
wall-clock ceiling on the call — the underlying HTTP transport adds a
small amount of socket-level overhead on top of the clamped deadline
(see the Python SDK's `WAIT_SOCKET_BUFFER`), so the call can return
slightly after the ceiling in practice. On a timeout just call it again.
``min_confidence`` filters out low-confidence OTP extractions.

``since`` (optional) only matches messages that arrived after this point:
an ISO8601 timestamp, unix seconds, or a message id (``msg_...``, meaning
"only messages after that one"; an unknown id falls back to the oldest
message, so prefer a timestamp if unsure). Omitted (the default), the
server matches only messages that arrive during this call — the right
choice for a fresh inbox from ``create_inbox``. When REUSING an inbox for
a second code and you want to catch one that already arrived before this
call, pass either the time just before you triggered this email, or the
``id`` of the last message you saw, so you get the NEW code instead of
missing it.

Side effects: none beyond the long-poll HTTP call(s) needed to satisfy the
wait (``openWorldHint`` — it talks to the live mailsocket API and blocks
for up to ``timeout`` seconds). Returns the OTP string, a confidence
score, the subject/from of the matching message, and its ``id`` /
``received_at`` (chain ``since=<id>`` into the next call on this inbox).
Raises a clean tool error (``WaitTimeout``) if nothing matching arrives
before the deadline.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sinceNo
timeoutNo
inbox_idYes
min_confidenceNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.1

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint; the description goes well beyond by disclosing the timeout clamping range (120 local / 55 remote), the socket-buffer overhead caveat, the retry-on-timeout behavior, the WaitTimeout error name, and the exact return payload. This is behavior an agent could not derive from the annotations alone.

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

Conciseness4/5

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

Front-loaded with the core contract in the first sentence, and most paragraphs earn their place. The WAIT_SOCKET_BUFFER digression is arguably more detail than a caller needs, making it slightly longer than necessary for the key decisions.

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?

With no output schema, the description correctly spells out the return fields (OTP, confidence, subject/from, id, received_at) and the failure mode. Every input parameter is explained, so an agent has everything needed to call and chain 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?

Schema coverage is 0%, so the description carries the full burden and does so: it explains timeout units and clamping, min_confidence's filtering role, the accepted ``since`` formats (ISO8601, unix seconds, ``msg_...`` id), the unknown-id fallback, and the default semantics of an omitted ``since``.

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?

Opens with a precise verb+resource+scope: 'Block (bounded) until an OTP arrives in ``inbox_id`` and return it.' It also self-labels as the 'headline tool', and the OTP-vs-link framing distinguishes it from the sibling wait_for_link without needing to open either schema.

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?

Strong when-to-use guidance: 'use it right after triggering a signup/login email' and 'Call it with the ``id`` returned by ``create_inbox``', plus detailed reuse guidance for the ``since`` parameter. It does not explicitly name or exclude alternatives like get_latest or wait_for_link, so sibling routing is left partly to inference.

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