MCPcopy
hub / github.com/codeaashu/claude-code / handleMessage

Function handleMessage

src/tools/SendMessageTool/SendMessageTool.ts:149–189  ·  view source on GitHub ↗
(
  recipientName: string,
  content: string,
  summary: string | undefined,
  context: ToolUseContext,
)

Source from the content-addressed store, hash-verified

147}
148
149async function handleMessage(
150 recipientName: string,
151 content: string,
152 summary: string | undefined,
153 context: ToolUseContext,
154): Promise<{ data: MessageOutput }> {
155 const appState = context.getAppState()
156 const teamName = getTeamName(appState.teamContext)
157 const senderName =
158 getAgentName() || (isTeammate() ? 'teammate' : TEAM_LEAD_NAME)
159 const senderColor = getTeammateColor()
160
161 await writeToMailbox(
162 recipientName,
163 {
164 from: senderName,
165 text: content,
166 summary,
167 timestamp: new Date().toISOString(),
168 color: senderColor,
169 },
170 teamName,
171 )
172
173 const recipientColor = findTeammateColor(appState, recipientName)
174
175 return {
176 data: {
177 success: true,
178 message: `Message sent to ${recipientName}'s inbox`,
179 routing: {
180 sender: senderName,
181 senderColor,
182 target: `@${recipientName}`,
183 targetColor: recipientColor,
184 summary,
185 content,
186 },
187 },
188 }
189}
190
191async function handleBroadcast(
192 content: string,

Callers 1

callFunction · 0.85

Calls 6

getTeamNameFunction · 0.85
getAgentNameFunction · 0.85
isTeammateFunction · 0.85
writeToMailboxFunction · 0.85
findTeammateColorFunction · 0.85
getTeammateColorFunction · 0.50

Tested by

no test coverage detected