> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arlohealth.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Wait for Reply

> Blocks until the next reply lands in the conversation (an AI triage
reply, a provider connecting, or a provider message) and returns it,
instead of polling GET /api/consultations/{id}. The REST form of the
wait_for_reply tool.

Resumable: when nothing arrives inside the window the response is
`stillWaiting: true`; call again with the same parameters. Pass the
last reply's messageId as `afterMessageId` to await what comes after
it. In IDLE or PAYMENT_REQUIRED there is nothing to wait for and the
response says so with a `nextStep`.




## OpenAPI

````yaml api-reference/openapi.yaml GET /api/consultations/{id}/reply
openapi: 3.1.0
info:
  title: Arlo Health MCP Server
  version: 1.0.0
  description: |
    Healthcare infrastructure for AI agents. Everything an agent needs
    to act in healthcare for its user.

    ## Overview

    This server exposes two interfaces:
    - **MCP** (Model Context Protocol) over streamable HTTP at `/` for AI agents
    - **REST API** at `/api/*` for bots, skills, and direct HTTP clients

    Both interfaces use the same tool handlers and authentication.

    ## Authentication

    OAuth 2.1 with PKCE. All `/api/*` endpoints require a Bearer token.

    Discovery endpoints (no auth required):
    - `/.well-known/oauth-protected-resource`
    - `/.well-known/oauth-authorization-server`
    - `/.well-known/mcp.json` (MCP Server Card)

    ## Service Regions

    Care is licensed by where the patient is physically located when they
    request it, so every conversation carries an ISO 3166-2 `region` code.
    Arlo currently serves California, United States (`US-CA`); an unsupported
    region is refused with `REGION_NOT_SUPPORTED`, whose payload names the
    regions Arlo serves at that moment.
  contact:
    name: Arlo Health
    url: https://arlohealth.ai
  license:
    name: Proprietary
    url: https://arlohealth.ai/tos
servers:
  - url: https://mcp.arlohealth.ai
    description: Production MCP Server
security:
  - oauth2:
      - openid
      - profile
      - email
      - offline_access
tags:
  - name: Discovery
    description: MCP and OAuth discovery endpoints (no auth required)
  - name: Profile
    description: User profile and patient information
  - name: Consultations
    description: Healthcare consultation management
  - name: Messaging
    description: Conversation messaging and media
  - name: Prescriptions
    description: Prescription orders (read-only; Photon Health fulfills them)
  - name: Health Records
    description: The user's connected insurance and health records (US)
  - name: Care Pricing
    description: Free price transparency under the user's plan (US)
  - name: Care Jobs
    description: >-
      Real-world care actions Arlo's care team executes after the patient
      approves (US)
  - name: Payment
    description: Billing and pay-per-use payment management
  - name: Webhooks
    description: Webhook registration and status
paths:
  /api/consultations/{id}/reply:
    get:
      tags:
        - Messaging
      summary: Wait for the next reply
      description: |
        Blocks until the next reply lands in the conversation (an AI triage
        reply, a provider connecting, or a provider message) and returns it,
        instead of polling GET /api/consultations/{id}. The REST form of the
        wait_for_reply tool.

        Resumable: when nothing arrives inside the window the response is
        `stillWaiting: true`; call again with the same parameters. Pass the
        last reply's messageId as `afterMessageId` to await what comes after
        it. In IDLE or PAYMENT_REQUIRED there is nothing to wait for and the
        response says so with a `nextStep`.
      operationId: waitForReply
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Consultation/conversation ID
        - name: afterMessageId
          in: query
          required: false
          schema:
            type: string
          description: Await the reply after this message (the last one you have seen)
        - name: maxWaitSeconds
          in: query
          required: false
          schema:
            type: integer
            minimum: 5
            maximum: 300
            default: 55
          description: >-
            How long one call may block. Defaults to 55 so a plain HTTP client's
            60-second timeout is never hit; clamped to 300.
      responses:
        '200':
          description: The next reply, several pending replies, or stillWaiting
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WaitReply'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    WaitReply:
      type: object
      description: |
        One of: a single reply, several pending replies, `stillWaiting` (resume
        with the same call), `connected` (a provider joined), or a note that
        the conversation has nothing pending to wait for.
      properties:
        conversationId:
          type: string
        status: 192865e6-ea37-4719-937e-8ec96bfd8583
        reply:
          $ref: '#/components/schemas/WaitEvent'
        replies:
          type: array
          description: >-
            Several replies had already arrived. Relay them in order, then call
            again with afterMessageId set to the LAST reply's messageId.
          items:
            $ref: '#/components/schemas/WaitEvent'
        stillWaiting:
          type: boolean
          description: >-
            True when nothing arrived within the window. Call again with the
            same parameters to resume; no duplicate side effects.
        waitedSeconds:
          type: integer
          description: With stillWaiting, how long this call blocked.
        connected:
          type: boolean
          description: >-
            True when a provider joined while waiting. Fetch the conversation,
            then message the provider.
        note:
          type: string
          description: >-
            Why there was nothing to wait for (IDLE, PAYMENT_REQUIRED,
            EMERGENCY).
        nextStep:
          type: string
        nextStepArgs:
          type: object
    WaitEvent:
      type: object
      description: A single inbound message or visit event.
      properties:
        from:
          type: string
          enum:
            - ai
            - provider
        type:
          type: string
          description: text, photo, file, prescription, lab_request, or a participant join
        text:
          type: string
        messageId:
          type: string
          description: >-
            Pass as afterMessageId to await the next reply, and as
            lastSeenMessageId when sending.
        fileName:
          type: string
        prescriptionOrderId:
          type: string
        timestamp:
          type: string
    Error:
      type: object
      description: Error response
      properties:
        error:
          type: string
          description: Error code
        reason:
          type: string
          description: Human-readable explanation
        code:
          type: string
          description: Detailed error code
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid authentication
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
              needsAuth:
                type: boolean
  securitySchemes:
    oauth2:
      type: oauth2
      description: OAuth 2.1 with PKCE
      flows:
        authorizationCode:
          authorizationUrl: /oauth/authorize
          tokenUrl: /oauth/token
          scopes:
            openid: OpenID Connect
            profile: User profile
            email: Email address
            offline_access: Refresh tokens

````