MCPcopy Create free account
hub / github.com/RioArisk/claudecode_api_RemoteControl / renderTool

Function renderTool

app/src/modules/renderer.js:799–834  ·  view source on GitHub ↗
(b)

Source from the content-addressed store, hash-verified

797}
798
799function renderTool(b) {
800 const list = ensureGroup();
801 S.currentGroupCount++;
802 S.currentGroup.querySelector('.step-count').textContent = S.currentGroupCount + ' steps';
803
804 const desc = toolDesc(b.name, b.input);
805 const item = document.createElement('div');
806 item.className = 'step-item loading';
807 item.dataset.toolId = b.id || '';
808 item.dataset.toolName = b.name || '';
809 item.innerHTML = `
810 <div class="step-icon">${iconFor(b.name)}</div>
811 <span class="step-name">${esc(b.name)}</span>
812 <span class="step-desc">${esc(trunc(desc, 40))}</span>
813 <span class="step-duration" id="dur-${b.id}"></span>
814 <span class="step-arrow"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg></span>
815 `;
816
817 const detail = document.createElement('div');
818 detail.className = 'step-detail';
819 detail.id = `detail-${b.id}`;
820 const inputFull = toolInputFull(b.name, b.input);
821 const isEdit = b.name === 'Edit' && b.input && b.input.old_string !== undefined;
822 if (isEdit) {
823 detail.innerHTML = buildDiffHtml(b.input.old_string, b.input.new_string, b.input.file_path, b.input._startLine);
824 } else {
825 detail.innerHTML = `
826 <div class="detail-input">${esc(inputFull)}</div>
827 <div class="detail-result" id="result-${b.id}"></div>
828 `;
829 }
830
831 list.appendChild(item);
832 list.appendChild(detail);
833 S.toolMap.set(b.id, { item, detail, name: b.name, group: S.currentGroup });
834}
835
836function attachResult(b) {
837 const info = S.toolMap.get(b.tool_use_id);

Callers 1

renderAssistantFunction · 0.70

Calls 7

escFunction · 0.90
truncFunction · 0.90
ensureGroupFunction · 0.70
toolDescFunction · 0.70
iconForFunction · 0.70
toolInputFullFunction · 0.70
buildDiffHtmlFunction · 0.70

Tested by

no test coverage detected