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

Function handlePlanRejection

src/tools/SendMessageTool/SendMessageTool.ts:524–564  ·  view source on GitHub ↗
(
  recipientName: string,
  requestId: string,
  feedback: string,
  context: ToolUseContext,
)

Source from the content-addressed store, hash-verified

522}
523
524async function handlePlanRejection(
525 recipientName: string,
526 requestId: string,
527 feedback: string,
528 context: ToolUseContext,
529): Promise<{ data: ResponseOutput }> {
530 const appState = context.getAppState()
531 const teamName = appState.teamContext?.teamName
532
533 if (!isTeamLead(appState.teamContext)) {
534 throw new Error(
535 'Only the team lead can reject plans. Teammates cannot reject their own or other plans.',
536 )
537 }
538
539 const rejectionResponse = {
540 type: 'plan_approval_response',
541 requestId,
542 approved: false,
543 feedback,
544 timestamp: new Date().toISOString(),
545 }
546
547 await writeToMailbox(
548 recipientName,
549 {
550 from: TEAM_LEAD_NAME,
551 text: jsonStringify(rejectionResponse),
552 timestamp: new Date().toISOString(),
553 },
554 teamName,
555 )
556
557 return {
558 data: {
559 success: true,
560 message: `Plan rejected for ${recipientName} with feedback: "${feedback}"`,
561 request_id: requestId,
562 },
563 }
564}
565
566export const SendMessageTool: Tool<InputSchema, SendMessageToolOutput> =
567 buildTool({

Callers 1

callFunction · 0.85

Calls 3

isTeamLeadFunction · 0.85
writeToMailboxFunction · 0.85
jsonStringifyFunction · 0.85

Tested by

no test coverage detected