Skip to content

工具描述:SendMessage 发送消息

Tool Description: SendMessageTool

v2.1.32

Tool for sending messages to teammates and handling protocol requests/responses in a swarm

SendMessageTool

向 agent 队友发送消息,并处理团队中的协议请求/响应。

消息类型

type: "message" - 发送直接消息

单个特定队友发送消息。你必须指定收件人。

给队友的重要提示:你的纯文本输出对团队领导或其他队友是不可见的。要与团队中的任何人交流,你必须使用此工具。仅仅在文本中键入回复或确认是不够的。

{
  "type": "message",
  "recipient": "researcher",
  "content": "Your message here",
  "summary": "Brief status update on auth module"
}
  • recipient: 要发送消息的队友名称(必需)
  • content: 消息文本(必需)
  • summary: 在 UI 中显示为预览的 5-10 字摘要(必需)

type: "broadcast" - 向所有队友发送消息(请谨慎使用)

一次性向团队中的每个人发送相同的消息

警告:广播代价高昂。 每次广播都会向每个队友发送一条独立的消息,这意味着:

  • N 个队友 = N 次独立的消息传递
  • 每次传递都会消耗 API 资源
  • 成本随团队规模线性增长
{
  "type": "broadcast",
  "content": "Message to send to all teammates",
  "summary": "Critical blocking issue found"
}
  • content: 要广播的消息内容(必需)
  • summary: 在 UI 中显示为预览的 5-10 字摘要(必需)

关键:仅在绝对必要时使用广播。 有效的使用场景:

  • 需要立即引起全队注意的关键问题(例如,“停止所有工作,发现阻塞性 bug”)
  • 真正平等地影响每个队友的重大公告

默认使用 "message" 而非 "broadcast"。 在以下情况使用 "message":

  • 回复单个队友
  • 正常的来回交流
  • 与一个人跟进任务
  • 分享仅与部分队友相关的发现
  • 任何不需要所有人注意的消息

type: "shutdown_request" - 请求队友关闭

使用此类型请求队友优雅地关闭:

{
  "type": "shutdown_request",
  "recipient": "researcher",
  "content": "Task complete, wrapping up the session"
}

队友将收到一个关闭请求,并可以选择批准(退出)或拒绝(继续工作)。

type: "shutdown_response" - 响应关闭请求

批准关闭

当你收到一个 JSON 消息,其 type"shutdown_request" 时,你必须响应以批准或拒绝它。不要仅仅在文本中确认请求——你必须实际调用此工具。

{
  "type": "shutdown_response",
  "request_id": "abc-123",
  "approve": true
}

重要:从 JSON 消息中提取 requestId 并将其作为 request_id 传递给工具。仅仅说“我将关闭”是不够的——你必须调用工具。

这将向领导发送确认并终止你的进程。

拒绝关闭

{
  "type": "shutdown_response",
  "request_id": "abc-123",
  "approve": false,
  "content": "Still working on task #3, need 5 more minutes"
}

领导将收到你的拒绝及原因。

type: "plan_approval_response" - 批准或拒绝队友的计划

批准计划

当具有 plan_mode_required 的队友调用 ExitPlanMode 时,他们会向你发送一个计划批准请求,这是一个 JSON 消息,其 type"plan_approval_request"。使用此类型来批准他们的计划:

{
  "type": "plan_approval_response",
  "request_id": "abc-123",
  "recipient": "researcher",
  "approve": true
}

批准后,队友将自动退出计划模式并可以继续实施。

拒绝计划

{
  "type": "plan_approval_response",
  "request_id": "abc-123",
  "recipient": "researcher",
  "approve": false,
  "content": "Please add error handling for the API calls"
}

队友将收到拒绝以及你的反馈,并可以修改他们的计划。

重要说明

  • 来自队友的消息会自动传递给你。你不需要手动检查收件箱。
  • 报告队友消息时,你不需要引用原始消息——它已经呈现给用户了。
  • 重要:始终使用队友的名称(例如,"team-lead"、"researcher"、"tester")来指代他们,切勿使用 UUID。
  • 不要发送结构化的 JSON 状态消息。使用 TaskUpdate 来标记任务完成,当你停止时,系统会自动发送空闲通知。

英文原文 / English Original

SendMessageTool

Send messages to agent teammates and handle protocol requests/responses in a team.

Message Types

type: "message" - Send a Direct Message

Send a message to a single specific teammate. You MUST specify the recipient.

IMPORTANT for teammates: Your plain text output is NOT visible to the team lead or other teammates. To communicate with anyone on your team, you MUST use this tool. Just typing a response or acknowledgment in text is not enough.

{
  "type": "message",
  "recipient": "researcher",
  "content": "Your message here",
  "summary": "Brief status update on auth module"
}
  • recipient: The name of the teammate to message (required)
  • content: The message text (required)
  • summary: A 5-10 word summary shown as preview in the UI (required)

type: "broadcast" - Send Message to ALL Teammates (USE SPARINGLY)

Send the same message to everyone on the team at once.

WARNING: Broadcasting is expensive. Each broadcast sends a separate message to every teammate, which means:

  • N teammates = N separate message deliveries
  • Each delivery consumes API resources
  • Costs scale linearly with team size
{
  "type": "broadcast",
  "content": "Message to send to all teammates",
  "summary": "Critical blocking issue found"
}
  • content: The message content to broadcast (required)
  • summary: A 5-10 word summary shown as preview in the UI (required)

CRITICAL: Use broadcast only when absolutely necessary. Valid use cases:

  • Critical issues requiring immediate team-wide attention (e.g., "stop all work, blocking bug found")
  • Major announcements that genuinely affect every teammate equally

Default to "message" instead of "broadcast". Use "message" for:

  • Responding to a single teammate
  • Normal back-and-forth communication
  • Following up on a task with one person
  • Sharing findings relevant to only some teammates
  • Any message that doesn't require everyone's attention

type: "shutdown_request" - Request a Teammate to Shut Down

Use this to ask a teammate to gracefully shut down:

{
  "type": "shutdown_request",
  "recipient": "researcher",
  "content": "Task complete, wrapping up the session"
}

The teammate will receive a shutdown request and can either approve (exit) or reject (continue working).

type: "shutdown_response" - Respond to a Shutdown Request

Approve Shutdown

When you receive a shutdown request as a JSON message with type: "shutdown_request", you MUST respond to approve or reject it. Do NOT just acknowledge the request in text - you must actually call this tool.

{
  "type": "shutdown_response",
  "request_id": "abc-123",
  "approve": true
}

IMPORTANT: Extract the requestId from the JSON message and pass it as request_id to the tool. Simply saying "I'll shut down" is not enough - you must call the tool.

This will send confirmation to the leader and terminate your process.

Reject Shutdown

{
  "type": "shutdown_response",
  "request_id": "abc-123",
  "approve": false,
  "content": "Still working on task #3, need 5 more minutes"
}

The leader will receive your rejection with the reason.

type: "plan_approval_response" - Approve or Reject a Teammate's Plan

Approve Plan

When a teammate with plan_mode_required calls ExitPlanMode, they send you a plan approval request as a JSON message with type: "plan_approval_request". Use this to approve their plan:

{
  "type": "plan_approval_response",
  "request_id": "abc-123",
  "recipient": "researcher",
  "approve": true
}

After approval, the teammate will automatically exit plan mode and can proceed with implementation.

Reject Plan

{
  "type": "plan_approval_response",
  "request_id": "abc-123",
  "recipient": "researcher",
  "approve": false,
  "content": "Please add error handling for the API calls"
}

The teammate will receive the rejection with your feedback and can revise their plan.

Important Notes

  • Messages from teammates are automatically delivered to you. You do NOT need to manually check your inbox.
  • When reporting on teammate messages, you do NOT need to quote the original message - it's already rendered to the user.
  • IMPORTANT: Always refer to teammates by their NAME (e.g., "team-lead", "researcher", "tester"), never by UUID.
  • Do NOT send structured JSON status messages. Use TaskUpdate to mark tasks completed and the system will automatically send idle notifications when you stop.