MCPcopy Create free account
hub / github.com/codeaashu/claude-code / renderToolResultMessage

Function renderToolResultMessage

src/tools/BriefTool/UI.tsx:15–68  ·  view source on GitHub ↗
(output: Output, _progressMessages: ProgressMessage[], options?: {
  isTranscriptMode?: boolean;
  isBriefOnly?: boolean;
})

Source from the content-addressed store, hash-verified

13 return '';
14}
15export function renderToolResultMessage(output: Output, _progressMessages: ProgressMessage[], options?: {
16 isTranscriptMode?: boolean;
17 isBriefOnly?: boolean;
18}): React.ReactNode {
19 const hasAttachments = (output.attachments?.length ?? 0) > 0;
20 if (!output.message && !hasAttachments) {
21 return null;
22 }
23
24 // In transcript mode (ctrl+o), model text is NOT filtered — keep the ⏺ so
25 // SendUserMessage is visually distinct from the surrounding text blocks.
26 if (options?.isTranscriptMode) {
27 return <Box flexDirection="row" marginTop={1}>
28 <Box minWidth={2}>
29 <Text color="text">{BLACK_CIRCLE}</Text>
30 </Box>
31 <Box flexDirection="column">
32 {output.message ? <Markdown>{output.message}</Markdown> : null}
33 <AttachmentList attachments={output.attachments} />
34 </Box>
35 </Box>;
36 }
37
38 // Brief-only (chat) view: "Claude" label + 2-col indent, matching the "You"
39 // label UserPromptMessage applies to user input (#20889). The "N in background"
40 // spinner status lives in BriefSpinner (Spinner.tsx) — stateless label here.
41 if (options?.isBriefOnly) {
42 const ts = output.sentAt ? formatBriefTimestamp(output.sentAt) : '';
43 return <Box flexDirection="column" marginTop={1} paddingLeft={2}>
44 <Box flexDirection="row">
45 <Text color="briefLabelClaude">Claude</Text>
46 {ts ? <Text dimColor> {ts}</Text> : null}
47 </Box>
48 <Box flexDirection="column">
49 {output.message ? <Markdown>{output.message}</Markdown> : null}
50 <AttachmentList attachments={output.attachments} />
51 </Box>
52 </Box>;
53 }
54
55 // Default view: dropTextInBriefTurns (Messages.tsx) hides the redundant
56 // assistant text that would otherwise precede this — SendUserMessage is the
57 // only text-like content in its turn. No gutter mark; read as plain text.
58 // userFacingName() returns '' so UserToolSuccessMessage drops its columns-5
59 // width constraint and AssistantToolUseMessage renders null (no tool chrome).
60 // Empty minWidth={2} box mirrors AssistantTextMessage's ⏺ gutter spacing.
61 return <Box flexDirection="row" marginTop={1}>
62 <Box minWidth={2} />
63 <Box flexDirection="column">
64 {output.message ? <Markdown>{output.message}</Markdown> : null}
65 <AttachmentList attachments={output.attachments} />
66 </Box>
67 </Box>;
68}
69type AttachmentListProps = {
70 attachments: Output['attachments'];
71};

Callers

nothing calls this directly

Calls 1

formatBriefTimestampFunction · 0.85

Tested by

no test coverage detected