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

Function call

src/tools/SendMessageTool/SendMessageTool.ts:741–913  ·  view source on GitHub ↗
(input, context, canUseTool, assistantMessage)

Source from the content-addressed store, hash-verified

739 },
740
741 async call(input, context, canUseTool, assistantMessage) {
742 if (feature('UDS_INBOX') && typeof input.message === 'string') {
743 const addr = parseAddress(input.to)
744 if (addr.scheme === 'bridge') {
745 // Re-check handle — checkPermissions blocks on user approval (can be
746 // minutes). validateInput's check is stale if the bridge dropped
747 // during the prompt wait; without this, from="unknown" ships.
748 // Also re-check isReplBridgeActive for outbound-only mode.
749 if (!getReplBridgeHandle() || !isReplBridgeActive()) {
750 return {
751 data: {
752 success: false,
753 message: `Remote Control disconnected before send — cannot deliver to ${input.to}`,
754 },
755 }
756 }
757 /* eslint-disable @typescript-eslint/no-require-imports */
758 const { postInterClaudeMessage } =
759 require('../../bridge/peerSessions.js') as typeof import('../../bridge/peerSessions.js')
760 /* eslint-enable @typescript-eslint/no-require-imports */
761 const result = await postInterClaudeMessage(
762 addr.target,
763 input.message,
764 )
765 const preview = input.summary || truncate(input.message, 50)
766 return {
767 data: {
768 success: result.ok,
769 message: result.ok
770 ? `“${preview}” → ${input.to}`
771 : `Failed to send to ${input.to}: ${result.error ?? 'unknown'}`,
772 },
773 }
774 }
775 if (addr.scheme === 'uds') {
776 /* eslint-disable @typescript-eslint/no-require-imports */
777 const { sendToUdsSocket } =
778 require('../../utils/udsClient.js') as typeof import('../../utils/udsClient.js')
779 /* eslint-enable @typescript-eslint/no-require-imports */
780 try {
781 await sendToUdsSocket(addr.target, input.message)
782 const preview = input.summary || truncate(input.message, 50)
783 return {
784 data: {
785 success: true,
786 message: `“${preview}” → ${input.to}`,
787 },
788 }
789 } catch (e) {
790 return {
791 data: {
792 success: false,
793 message: `Failed to send to ${input.to}: ${errorMessage(e)}`,
794 },
795 }
796 }
797 }
798 }

Callers

nothing calls this directly

Calls 15

featureFunction · 0.85
parseAddressFunction · 0.85
getReplBridgeHandleFunction · 0.85
toAgentIdFunction · 0.85
isLocalAgentTaskFunction · 0.85
isMainSessionTaskFunction · 0.85
queuePendingMessageFunction · 0.85
resumeAgentBackgroundFunction · 0.85
handleBroadcastFunction · 0.85
handleMessageFunction · 0.85
handleShutdownRequestFunction · 0.85
handleShutdownApprovalFunction · 0.85

Tested by

no test coverage detected