MCPcopy Create free account
hub / github.com/Noumena-Network/code / handleMessage

Function handleMessage

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

Source from the content-addressed store, hash-verified

193}
194
195async function handleMessage(
196 recipientName: string,
197 content: string,
198 summary: string | undefined,
199 context: ToolUseContext,
200): Promise<{ data: MessageOutput }> {
201 const appState = context.getAppState()
202 const teamName = getTeamName(appState.teamContext)
203 const senderName =
204 getAgentName() || (isTeammate() ? 'teammate' : TEAM_LEAD_NAME)
205 const senderColor = getTeammateColor()
206
207 await writeToMailbox(
208 recipientName,
209 {
210 from: senderName,
211 text: content,
212 summary,
213 timestamp: new Date().toISOString(),
214 color: senderColor,
215 },
216 teamName,
217 )
218
219 const recipientColor = findTeammateColor(appState, recipientName)
220
221 return {
222 data: {
223 success: true,
224 message: `Message sent to ${recipientName}'s inbox`,
225 routing: {
226 sender: senderName,
227 senderColor,
228 target: `@${recipientName}`,
229 targetColor: recipientColor,
230 summary,
231 content,
232 },
233 },
234 }
235}
236
237async function handleBroadcast(
238 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