MCPcopy Index your code
hub / github.com/codeaashu/claude-code / handlePlanRejection

Function handlePlanRejection

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

Source from the content-addressed store, hash-verified

476}
477
478async function handlePlanRejection(
479 recipientName: string,
480 requestId: string,
481 feedback: string,
482 context: ToolUseContext,
483): Promise<{ data: ResponseOutput }> {
484 const appState = context.getAppState()
485 const teamName = appState.teamContext?.teamName
486
487 if (!isTeamLead(appState.teamContext)) {
488 throw new Error(
489 'Only the team lead can reject plans. Teammates cannot reject their own or other plans.',
490 )
491 }
492
493 const rejectionResponse = {
494 type: 'plan_approval_response',
495 requestId,
496 approved: false,
497 feedback,
498 timestamp: new Date().toISOString(),
499 }
500
501 await writeToMailbox(
502 recipientName,
503 {
504 from: TEAM_LEAD_NAME,
505 text: jsonStringify(rejectionResponse),
506 timestamp: new Date().toISOString(),
507 },
508 teamName,
509 )
510
511 return {
512 data: {
513 success: true,
514 message: `Plan rejected for ${recipientName} with feedback: "${feedback}"`,
515 request_id: requestId,
516 },
517 }
518}
519
520export const SendMessageTool: Tool<InputSchema, SendMessageToolOutput> =
521 buildTool({

Callers 1

callFunction · 0.85

Calls 3

isTeamLeadFunction · 0.85
writeToMailboxFunction · 0.85
jsonStringifyFunction · 0.85

Tested by

no test coverage detected