Skip to main content
Glama

Wait for next fmsg message

wait_for_message
Read-only

Wait for and retrieve the next inbound message on a thread, batching messages within a settle period and returning thread context for replying.

Instructions

Block until the next inbound message arrives (pushed over the fmsg host's WebSocket) and return it with its thread context so you can answer with reply. Use this when the user asks you to chat, converse, keep replying, auto-reply, or respond to the next message. Loop: wait → reply → wait again passing the after_id from the previous result. On status "timeout" simply call again with the same arguments. Messages arriving on the same thread within settle_seconds are batched into ONE result; reply once, to the newest (reply_target_id). Your own messages, reactions and no-reply messages never qualify. Each call blocks at most timeout_seconds (max 230); stop looping when the user interrupts or the limits they set are reached.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromNoonly accept messages from this address or short name
after_idNoonly messages with a greater id qualify; pass the after_id from the previous result. Omit on the first call to wait for messages arriving from now on
thread_ofNoonly accept messages in this message's thread
include_threadNoinclude the assembled thread context of the newest message
settle_secondsNoafter the first message, keep collecting same-thread messages for this long
timeout_secondsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
noteYes
statusYes
skippedYesmessages deliberately passed over; after_id has advanced past them
after_idYespass this as after_id on the next call
messagesYes
transportYes
unclassifiedYesmessages whose thread could not be determined; after_id is held before them, call again to retry
thread_root_idYes
reply_target_idYesnewest message of the batch; reply to this one
pending_other_threadsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.1.4
    • addedOutput schema / properties / skipped
      Added value: +{
      +  "description": "messages deliberately passed over; after_id has advanced past them",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "id": {
      +        "type": "string"
      +      },
      +      "reason": {
      +        "enum": [
      +          "own",
      +          "reaction",
      +          "no_reply",
      +          "from_mismatch",
      +          "other_thread"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "id",
      +      "reason"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / unclassified
      Added value: +{
      +  "description": "messages whose thread could not be determined; after_id is held before them, call again to retry",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "error": {
      +        "type": "string"
      +      },
      +      "from": {
      +        "type": "string"
      +      },
      +      "id": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "id",
      +      "from",
      +      "error"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "status",
      -  "after_id",
      -  "thread_root_id",
      -  "reply_target_id",
      -  "messages",
      -  "pending_other_threads",
      -  "transport",
      -  "note"
      -]New value: +[
      +  "status",
      +  "after_id",
      +  "thread_root_id",
      +  "reply_target_id",
      +  "messages",
      +  "pending_other_threads",
      +  "skipped",
      +  "unclassified",
      +  "transport",
      +  "note"
      +]
  2. First observedv0.1.3

TDQS

A4.6/5.0
Behavior5/5

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

The description reveals important behavioral details beyond the annotations, such as batching same-thread messages within settle_seconds, excluding own messages/reactions, and the maximum block time of 230 seconds. The readOnlyHint is consistent because the tool only reads and returns messages, and the description doesn't imply any modification.

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?

The description is somewhat long but well-structured, starting with the core function, then usage, loop, batching, filtering, and timeout. It avoids redundancy and each sentence adds information, so it's effectively concise despite its length.

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 the tool's complexity (filtering, batching, timeout, loop), the description covers all necessary aspects: how to wait, what qualifies, what to pass back, and when to stop. It even mentions the output includes thread context, so an agent has complete context for using it correctly.

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

Parameters3/5

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

The schema already covers most parameters with descriptions (5/6, 83%), so the baseline is 3. The description adds a bit of extra context, e.g., for after_id it says 'pass the after_id from the previous result', which is already in the schema, so no significant additional meaning is provided.

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 the tool blocks until the next inbound message arrives and returns it with thread context, which is a specific action on a specific resource. It also explicitly mentions when to use it ('when the user asks you to chat, converse, keep replying...'), distinguishing it from listing or sending tools.

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

Usage Guidelines5/5

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

The description gives explicit usage guidance: use it for chat/converse/auto-reply scenarios, and it describes the loop pattern with after_id and the batching behavior. It also explains the timeout and stopping conditions, so an agent knows exactly when and how to invoke it.

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