MCPcopy Create free account
hub / github.com/freecodexyz/free-code / renderToolUseMessage

Function renderToolUseMessage

src/tools/PowerShellTool/UI.tsx:19–49  ·  view source on GitHub ↗
(input: Partial<PowerShellToolInput>, {
  verbose,
  theme: _theme
}: {
  verbose: boolean;
  theme: ThemeName;
})

Source from the content-addressed store, hash-verified

17const MAX_COMMAND_DISPLAY_LINES = 2;
18const MAX_COMMAND_DISPLAY_CHARS = 160;
19export function renderToolUseMessage(input: Partial<PowerShellToolInput>, {
20 verbose,
21 theme: _theme
22}: {
23 verbose: boolean;
24 theme: ThemeName;
25}): React.ReactNode {
26 const {
27 command
28 } = input;
29 if (!command) {
30 return null;
31 }
32 const displayCommand = command;
33 if (!verbose) {
34 const lines = displayCommand.split('\n');
35 const needsLineTruncation = lines.length > MAX_COMMAND_DISPLAY_LINES;
36 const needsCharTruncation = displayCommand.length > MAX_COMMAND_DISPLAY_CHARS;
37 if (needsLineTruncation || needsCharTruncation) {
38 let truncated = displayCommand;
39 if (needsLineTruncation) {
40 truncated = lines.slice(0, MAX_COMMAND_DISPLAY_LINES).join('\n');
41 }
42 if (truncated.length > MAX_COMMAND_DISPLAY_CHARS) {
43 truncated = truncated.slice(0, MAX_COMMAND_DISPLAY_CHARS);
44 }
45 return <Text>{truncated.trim()}…</Text>;
46 }
47 }
48 return displayCommand;
49}
50export function renderToolUseProgressMessage(progressMessagesForMessage: ProgressMessage<PowerShellProgress>[], {
51 verbose,
52 tools: _tools,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected