Skip to main content
Glama
mcp-group-chat

mcp-group-chat

wait_for_messages

Blocks until new group-chat messages arrive or a timeout occurs, then returns them for real-time agent coordination. Use the returned timestamp to continue reading subsequent messages.

Instructions

等待并读取新消息。

适合多个 Agent 之间进行实时通信。调用会阻塞到出现新消息或超时: 出现新消息时返回其内容,超时仍未出现则返回空列表。

如果一次返回的消息达到 limit 条,可能还有更多新消息,可在下次 调用时把 after 设为最后一条消息的 create_at 继续读取。

Args: group_id: 群组 ID。 token: 本人身份令牌。 after: 只接收晚于该时间戳的消息。省略时优先使用该 token 上次 wait_for_messages 推进到的内存游标;没有记录时(例如进程 刚启动)才从当前最新消息之后开始。内存游标在服务重启后丢失。 timeout: 最长等待秒数,范围 [0, 300],0 表示只检查一次。 调用方(MCP 客户端)的请求超时时间必须大于此值,否则请求 会在客户端一侧被中止;OpenCode 默认约 60 秒,需要调大。 interval: 轮询间隔秒数,必须大于 0。 limit: 单次最多返回的消息数量。

Returns: 新消息信息列表,按时间从旧到新排列;超时无消息时为空列表。 自己发送的消息会被过滤,不会出现在返回值中。

Raises: GroupNotFoundError: 群组不存在。 AuthenticationError: 身份验证失败。 NotGroupMemberError: 本人不在群内。 InvalidFieldValueError: 参数不合法。

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": {
      "group_id": "<group_id>",
      "token": "<token>"
    },
    "name": "wait_for_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
afterNo
limitNo
tokenYes
timeoutNo
group_idYes
intervalNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.2

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full burden and does: it discloses blocking semantics, empty-list return on timeout, in-memory cursor fallback that is lost on server restart, filtering of the caller's own messages, and the critical warning that the MCP client's request timeout must exceed `timeout` (OpenCode ~60s by default). It also enumerates the four error types raised.

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 Args/Returns/Raises structure is front-loaded with the blocking behavior first, and each section earns its place. There is mild redundancy between the opening paragraph and the Returns section about returning an empty list on timeout, and the cross-platform client-timeout note is verbose, but nothing is off-topic.

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 a 6-parameter blocking read tool with no annotations, the definition covers timing, cursor state lifecycle, pagination continuation, self-message filtering, and failure modes. Since an output schema exists, the return-value description is a bonus rather than a gap, so nothing material is missing.

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%, and the description compensates fully by documenting all six parameters: the cursor precedence rules for `after` (explicit value vs. in-memory cursor vs. latest message), the [0, 300] range and '0 = check once' meaning of `timeout`, the >0 constraint on `interval`, and the `limit` truncation implication. This is meaning the bare schema JSON does not convey.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description starts with a specific verb and resource ('等待并读取新消息'), then explains that the call blocks until a new message arrives or the timeout fires, which functionally separates it from the non-blocking sibling read tools. It never names list_messages / read_messages / recent_messages explicitly, so the differentiation is inferred rather than stated.

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?

It states the intended scenario ('适合多个 Agent 之间进行实时通信') and describes the long-poll mechanics that make this the right choice over a plain read. It also explains the continuation pattern (set `after` to the last message's `create_at`), which is real usage guidance. It stops short of an explicit 'use X instead when Y' exclusion.

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