SendMessageTool: Agent Communication
8/2/2026, 4:37:57 PM · updated 8/8/2026, 10:44:59 AM · Source
AI-translated on 8/2/2026, 4:40:05 PM · by Qwen3.6 35B (fast, default)
The retrieved knowledge base entries do not contain specific information about **SendMessageTool** within Claude Code's multi-agent architecture, including its message protocol design, input schema, or communication mechanisms. The results focus on general computing concepts such as network protocols (e.g., packet transmission in CSN-1.C), student response systems, and biological signaling—none of which directly address the technical details requested. Given that your recent activity includes work on **K12/Agent toolchain task suspension stop mechanism** and related Claude Code components (*detailed under "Recently working on"* above), this specific gap suggests either: 1) The topic may not yet be documented in the current knowledge base, or 2) A more targeted search (e.g., using a narrower query like "Claude Code SendMessageTool input schema" or expanding to external tools) would be necessary to locate relevant details. I cannot fabricate or extrapolate technical specifications from unrelated materials. If this is blocking your progress, consider: - Using `mcp__tavily__tavily_search` for real-time web research on Claude Code documentation. - Reviewing internal skill files like `K12/GlobTool design principles FileEditTool FileWriteTool` (if they contain toolchain context). Would you like me to attempt a more refined search or explore external tools?
It Serves as the Communication Bus in Multi-Agent Mode
In Claude Code's multi-agent architecture, plain text is not automatically visible to other teammates.
So if an agent wants to notify another agent, broadcast a message, or respond to an approval, it must route through SendMessageTool.
This means the tool isn't an auxiliary feature, but the foundational infrastructure that makes a true multi-agent system possible.
Key Source Code
tools/SendMessageTool/SendMessageTool.ts:
const inputSchema = z.object({
to: z.string(),
summary: z.string().optional(),
message: z.union([z.string(), StructuredMessage()]),
})
And StructuredMessage supports several types of special messages:
type: 'shutdown_request'
type: 'shutdown_response'
type: 'plan_approval_response'
This indicates that it doesn't just send plain text, but already supports protocol-formatted messaging.
Message Routing Chain
An agent needs to contact someone > SendMessageTool > Resolve to address > Write to mailbox / bridge / peer > Target agent receives the message > Continue collaboration or update state
It Supports More Than Just Teammate Names
Learning map
Learning Roadmap
Phase One: Conceptual Foundation — Why Multi-Agent Systems Need Dedicated Communication?
- Understand that agents cannot share context text by default (each conversation is isolated)
- Distinguish the scope differences between "plain text" and "protocol messages"
- Understand the basic architecture of the Claude Code multi-agent system (Lead Agent → Teammates)
Phase Two: Core Source Code — Message Schema of SendMessageTool
- Master the meaning and constraints of the input parameters
to,summary, andmessage - Understand the
StructuredMessagetype hierarchy (shutdown_request/response, plan_approval_response, etc.) - Grasp how the tool upgrades messages from "free-form text" to "protocol messages"
Phase Three: Invocation Path — How a Message Reaches Its Target Agent
SendMessageTool→ routing/parsing of thetoaddress → mailbox / bridge / peer → delivery to target agent- Understand how the request-response model drives collaboration and approvals in agent negotiations
Phase Four: Advanced Scenarios — Applications Beyond Teammate Names
- Cross-machine multi-agent collaboration (Shared Channel + Real-time Messaging)
- Enhance agent-to-agent protocol security via MCP (authentication, approval workflows)
- Integrate with companion tools such as TaskCreate/UpdateTool and TeamCreate/DeleteTool to implement complete team workflows
Get hands-on — step by step
Hands-on Exercise
- Install and start Claude Code (run
claudein the terminal), ensuring the version includes multi-Agent support. - Open a real project directory, activate Claude Code in the terminal, and enter a task request that triggers multi-Agent behavior (e.g., "Help me split this PR's code review and documentation tasks, assigning them to two sub-agents for parallel processing").
- Observe Claude Code's Agent allocation output—confirm that the Lead Agent created Teammate A and Teammate B.
- In the Lead Agent's response, find the
SendMessageTooltool call record (the tool block starting withsendMessageorSend Message), and parse its parameters:to: the target Agent's name / IDmessage: the command or structured message fields it carries
- Switch terminal windows or continue in the same session to trigger an approval scenario request (e.g., "Please modify the API routes under src/; I'll review them after you're done")—observe how the Lead Agent sends a
plan_approval_responsetype message via SendMessageTool to the dispatched sub-agent. - (Advanced) Clone the willin/claude-code-source-code repository, locate
tools/SendMessageTool/SendMessageTool.ts:- Read the complete input Schema definition
- Trace the communication logic of mailbox and worker in the
bridge/andcoordinator/directories
- (Advanced) Attempt to check the cross-machine communication design plan at Anthropic Claude Code GitHub issues #28300 (Agent-to-Agent protocol), and understand how Shared Channel + Real-time Messaging expands the capabilities boundary of SendMessageTool.
Top 3 sources
- 1willin/claude-code-source-code — Claude Code v2.1.88 源码仓库
逐文件整理并文档化的 Claude Code 源码库,README 中明确列出了 SendMessageTool 在通信总线架构中的位置、调用链与多 Agent 协作机制。
https://github.com/willin/claude-code-source-code
- 2Anthropic claude-code Issue #28300 — Agent-to-Agent Protocol
Anthropic 官方 issue,阐述多机器跨 Agent 通信协议设计——Shared Channel、Real-time Messaging 和安全审批机制的演进方向。
https://github.com/anthropics/claude-code/issues/28300
- 3Claude Code 官方文档
Anthropic 官方发布的 Claude Code 使用指南,涵盖 Agent 工具调用、多智能体协作模式与 MCP Server 集成的完整说明。
https://docs.anthropic.com/en/docs/claude-code/overview
Links are AI-suggested — worth a quick sanity check before diving in.