Skip to main content
Glama
jgottlieb84

agentline-mcp

by jgottlieb84

wait_for_sms

Long-poll for inbound SMS after form submission. Use optional regex matching to filter messages and extract codes. Returns message body or timeout status.

Instructions

Long-poll (blocking up to timeout seconds, max 180) for the next inbound SMS on a provisioned number. Use this right AFTER submitting a form that triggers an SMS — call this to catch the reply.

match is an optional regex (e.g. \d{6} for a 6-digit code) — only messages matching the pattern satisfy the wait. Any inbound message satisfies it when match is None.

Returns the message dict (with body and auto-extracted extracted_code when present), or {"message": null, "status": "timeout"} if no message arrived in time.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
phone_numberYes
timeoutNo
matchNo

Implementation Reference

  • The wait_for_sms tool handler function decorated with @mcp.tool(). It long-polls for an inbound SMS on a provisioned number, optionally matching a regex. Returns the message dict or timeout status.
    @mcp.tool()
    def wait_for_sms(
        phone_number: str,
        timeout: float = DEFAULT_WAIT_TIMEOUT,
        match: str | None = None,
    ) -> dict:
        """Long-poll (blocking up to `timeout` seconds, max 180) for the next inbound
        SMS on a provisioned number. Use this right AFTER submitting a form that
        triggers an SMS — call this to catch the reply.
    
        `match` is an optional regex (e.g. `\\d{6}` for a 6-digit code) — only
        messages matching the pattern satisfy the wait. Any inbound message satisfies
        it when `match` is None.
    
        Returns the message dict (with `body` and auto-extracted `extracted_code`
        when present), or `{"message": null, "status": "timeout"}` if no message
        arrived in time.
        """
        try:
            msg = _client_or_init().wait_for_sms(
                phone_number=phone_number,
                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}
  • The tool is registered via the @mcp.tool() decorator on line 132, which is the FastMCP registration mechanism.
    def wait_for_sms(
  • Helper function _clamp_timeout clamps the timeout value between 1.0 and MAX_WAIT_TIMEOUT (180.0), used by wait_for_sms.
    def _clamp_timeout(timeout: float) -> float:
        return max(1.0, min(float(timeout), MAX_WAIT_TIMEOUT))
  • Helper _client_or_init() lazily initializes and returns the Agentline SDK client, used by wait_for_sms to call the SDK method.
    def _client_or_init() -> Agentline:
        global _client
        if _client is None:
            _client = _build_client()
        return _client
  • Constants DEFAULT_WAIT_TIMEOUT (60.0) and MAX_WAIT_TIMEOUT (180.0) define the default and max timeout values used in wait_for_sms parameter schema.
    DEFAULT_WAIT_TIMEOUT = 60.0
    MAX_WAIT_TIMEOUT = 180.0
Behavior4/5

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

No annotations provided, but description fully discloses blocking behavior (long-poll), timeout max, optional regex, and return structure including timeout case. Does not cover auth or rate limits, but sufficient for a non-mutating operation.

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?

Four well-structured sentences with zero waste. Purpose, usage, parameter explanation, and return value are each in separate logical units.

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?

Covers inputs, behavior, and output fully. No output schema, but return values are described in detail. Complete for an agent to decide invocation.

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 has 0% description coverage, but description explains phone_number implicitly, timeout with max 180, and match with default and behavior. Adds significant meaning beyond schema, though phone_number could be more explicit.

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?

Clearly states it is a long-poll for the next inbound SMS on a provisioned number, with explicit verb and resource. Distinguishes from siblings like wait_for_email by specifying SMS focus.

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 to use after submitting a form that triggers an SMS, which provides context. Could mention alternatives or when not to use, but current guidance is clear.

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