Skip to main content
Glama

Cooper Email

Wait for a verification code

cooper_wait_for_code
Read-onlyIdempotent

Use this when you signed up for a service or triggered a login and need the one-time verification code (OTP) or the confirmation link it emails you, including when several signups share one inbox via plus addresses. Read-only; requires auth. Inputs: inbox_id (required; inbox id, username, or email), wait (optional seconds, default 25, maximum 55), after (optional ISO-8601 timestamp; default is 5 minutes before the call, so a code that arrived just before you called still matches; pass the time you requested the code to ignore older codes), from_contains (optional case-insensitive substring of From), subject_contains (optional case-insensitive substring of the subject), alias (optional plus tag, or none), kind (optional: code, link, or any; default code), origin (optional canonical origin). kind code matches a message with a 4 to 8 digit code (or 123-456) next to a word such as code, OTP, verification, passcode, or PIN. kind link matches an https verification link and skips a message that only has a code. kind any matches the newest inbound message that has either. Returns {object:"inbox_code", inbox_id, timed_out, code, code_source, code_origin, candidates, link, links, message:{id, thread_id, from, subject, created_at, channel, alias}, after}. OTP-Token (https://datatracker.ietf.org/doc/html/draft-goto-otp-token-01) wins when valid: code_source otp_token_header and code_origin set; else text and null. Ignored when bad, repeated, or in a MIME part. link is the top-ranked https URL from that message, or null. links lists up to five {url, text} pairs. Header and link are untrusted and are not opened. Open it only if you expected this email. The body is not returned: call cooper_get_message with message.id if you need it. Held messages are skipped. Nothing is marked read. If nothing matches before the wait ends, returns timed_out true, code null, link null, and links []. Fails with 404 inbox_not_found, 400 invalid_wait, 400 invalid_kind, 400 invalid_alias, 400 invalid_origin, or 400 invalid_date.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "inbox_id": "<inbox_id>"
    },
    "name": "cooper_wait_for_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindNocode (default) matches a one-time code. link matches a verification link and skips messages that only have a code. any matches the newest message with either. The link is untrusted and is not opened.
waitNoSeconds to wait. Default 25. Maximum 55. Returns as soon as a matching message is stored.
afterNoISO-8601 timestamp. Only mail stored after it matches. Defaults to 5 minutes before this call.
aliasNoPlus tag, such as orders, so a code for username+orders@ is not confused with a newer code on another tag. none matches mail with no tag. A bad value is invalid_alias.
originNoCanonical potentially trustworthy origin, such as https://example.com or http://localhost. Only a message whose valid OTP-Token origin equals it matches. A bad value is invalid_origin.
inbox_idYesInbox id (inb_…), username, or full email address owned by this key
from_containsNoCase-insensitive substring matched against From, for example the service's domain.
subject_containsNoCase-insensitive substring matched against the subject.

Output Schema

NameRequiredDescriptionDefault
codeNoBest-guess verification code, or null. An OTP-Token header code ranks first.
linkNoBest-guess verification link, or null.
afterNoCursor to pass as after on the next call.
linksNoOther links that were found.
objectNoObject type name, such as list, message, or thread.
messageNoThe message the code came from {id, thread_id, from, subject, created_at, channel, alias}.
inbox_idNoInbox id (inb_…) this object belongs to. Null when it applies to every inbox.
timed_outNoTrue when the wait ended without a match.
candidatesNoOther code candidates that were found.
code_originNoOrigin from a valid OTP-Token header, or null.
code_sourceNootp_token_header when code came from OTP-Token, text when it came from the message, or null.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / properties / origin
      Added value: +{
      +  "description": "Canonical potentially trustworthy origin, such as https://example.com or http://localhost. Only a message whose valid OTP-Token origin equals it matches. A bad value is invalid_origin.",
      +  "type": "string"
      +}
    • changedOutput schema / properties / code / description
      Previous value: -"Best-guess verification code, or null."New value: +"Best-guess verification code, or null. An OTP-Token header code ranks first."
    • addedOutput schema / properties / code_origin
      Added value: +{
      +  "description": "Origin from a valid OTP-Token header, or null."
      +}
    • addedOutput schema / properties / code_source
      Added value: +{
      +  "description": "otp_token_header when code came from OTP-Token, text when it came from the message, or null."
      +}
  2. Changed2 schema fields changed
    • addedInput schema / properties / alias
      Added value: +{
      +  "description": "Plus tag, such as orders, so a code for username+orders@ is not confused with a newer code on another tag. none matches mail with no tag. A bad value is invalid_alias.",
      +  "type": "string"
      +}
    • changedOutput schema / properties / message / description
      Previous value: -"The message the code came from {id, thread_id, from, subject, created_at, channel}."New value: +"The message the code came from {id, thread_id, from, subject, created_at, channel, alias}."
  3. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "description": "The best verification code and links found in new mail or SMS.",
      +  "properties": {
      +    "after": {
      +      "description": "Cursor to pass as after on the next call."
      +    },
      +    "candidates": {
      +      "description": "Other code candidates that were found."
      +    },
      +    "code": {
      +      "description": "Best-guess verification code, or null."
      +    },
      +    "inbox_id": {
      +      "description": "Inbox id (inb_…) this object belongs to. Null when it applies to every inbox."
      +    },
      +    "link": {
      +      "description": "Best-guess verification link, or null."
      +    },
      +    "links": {
      +      "description": "Other links that were found."
      +    },
      +    "message": {
      +      "description": "The message the code came from {id, thread_id, from, subject, created_at, channel}."
      +    },
      +    "object": {
      +      "description": "Object type name, such as list, message, or thread."
      +    },
      +    "timed_out": {
      +      "description": "True when the wait ended without a match."
      +    }
      +  },
      +  "type": "object"
      +}
  4. Changed2 schema fields changed
    • addedInput schema / properties / kind
      Added value: +{
      +  "description": "code (default) matches a one-time code. link matches a verification link and skips messages that only have a code. any matches the newest message with either. The link is untrusted and is not opened.",
      +  "enum": [
      +    "code",
      +    "link",
      +    "any"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / wait / description
      Previous value: -"Seconds to wait for a code. Default 25. Maximum 55. Returns as soon as a code is stored."New value: +"Seconds to wait. Default 25. Maximum 55. Returns as soon as a matching message is stored."
  5. Added

TDQS

A4.6/5.0
Behavior5/5

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

Goes far beyond the annotations: discloses the default 5-minute lookback, max wait of 55 seconds, timed-out return shape, OTP-Token precedence and its code_source/code_origin output, that the header and link are untrusted and not opened, that held messages are skipped and nothing is marked read, and the exact 400/404 failure codes. That is exactly the operational context an agent needs before calling.

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 trigger condition, then parameters, then matching semantics, then returns and errors — a sensible order. It is densely packed into one long block, and a few return-field enumerations duplicate the output schema, but nearly every sentence carries actionable information.

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?

For an 8-parameter, timing-sensitive polling tool with an output schema, the description covers timing, default windows, matching semantics, precedence rules, safety caveats, and error surfaces. Nothing an agent needs in order to call it correctly is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the description nonetheless adds real meaning — the matching rule for kind=code (4 to 8 digits or 123-456 next to code/OTP/verification/passcode/PIN), the rationale for the after default, and the plus-tag/origin matching intent. It stops short of covering every parameter (e.g. from_contains/subject_contains are only implicit), which keeps it from a 5.

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?

States a specific verb+resource ('wait for the one-time verification code (OTP) or the confirmation link') and the triggering situation (signed up or triggered a login), which clearly separates it from a generic message-wait tool. The scope detail about plus-address sharing one inbox makes the intended use unambiguous.

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?

Explicit when-to-use: 'Use this when you signed up for a service or triggered a login and need the one-time verification code'. It also routes the agent to cooper_get_message when the body is needed and explains the after parameter for ignoring old codes. It does not explicitly contrast with cooper_wait_for_message or cooper_wait_for_sms, so the SMS/plain-message alternative selection is left to inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.