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

Function renderToolUseMessage

src/utils/computerUse/toolRendering.tsx:59–110  ·  view source on GitHub ↗
(input: CuToolInput)

Source from the content-addressed store, hash-verified

57 // the tool name without "(args)". Every path below returns '' when there's
58 // nothing to show — never null.
59 renderToolUseMessage(input: CuToolInput) {
60 switch (toolName) {
61 case 'screenshot':
62 case 'left_mouse_down':
63 case 'left_mouse_up':
64 case 'cursor_position':
65 case 'list_granted_applications':
66 case 'read_clipboard':
67 return '';
68 case 'left_click':
69 case 'right_click':
70 case 'middle_click':
71 case 'double_click':
72 case 'triple_click':
73 case 'mouse_move':
74 return fmtCoord(input.coordinate);
75 case 'left_click_drag':
76 return input.start_coordinate ? `${fmtCoord(input.start_coordinate)} → ${fmtCoord(input.coordinate)}` : `to ${fmtCoord(input.coordinate)}`;
77 case 'type':
78 return typeof input.text === 'string' ? `"${truncateToWidth(input.text, 40)}"` : '';
79 case 'key':
80 case 'hold_key':
81 return typeof input.text === 'string' ? input.text : '';
82 case 'scroll':
83 return [input.direction, input.amount && `×${input.amount}`, input.coordinate && `at ${fmtCoord(input.coordinate)}`].filter(Boolean).join(' ');
84 case 'zoom':
85 {
86 const r = input.region;
87 return Array.isArray(r) && r.length === 4 ? `[${r[0]}, ${r[1]}, ${r[2]}, ${r[3]}]` : '';
88 }
89 case 'wait':
90 return typeof input.duration === 'number' ? `${input.duration}s` : '';
91 case 'write_clipboard':
92 return typeof input.text === 'string' ? `"${truncateToWidth(input.text, 40)}"` : '';
93 case 'open_application':
94 return typeof input.bundle_id === 'string' ? String(input.bundle_id) : '';
95 case 'request_access':
96 {
97 const apps = input.apps;
98 if (!Array.isArray(apps)) return '';
99 const names = apps.map(a => typeof a?.displayName === 'string' ? a.displayName : '').filter(Boolean);
100 return names.join(', ');
101 }
102 case 'computer_batch':
103 {
104 const actions = input.actions;
105 return Array.isArray(actions) ? `${actions.length} actions` : '';
106 }
107 default:
108 return '';
109 }
110 },
111 renderToolResultMessage(output, _progress, {
112 verbose
113 }) {

Callers

nothing calls this directly

Calls 2

fmtCoordFunction · 0.85
truncateToWidthFunction · 0.85

Tested by

no test coverage detected