MCPcopy Create free account
hub / github.com/github/gh-aw / appendToolExecutionLine

Function appendToolExecutionLine

actions/setup/js/log_parser_format.cjs:447–501  ·  view source on GitHub ↗
(lines, content, toolUsePairs, state)

Source from the content-addressed store, hash-verified

445 }
446
447 function appendToolExecutionLine(lines, content, toolUsePairs, state) {
448 const toolName = content.name;
449 const input = content.input || {};
450
451 if (INTERNAL_TOOLS.includes(toolName)) {
452 return;
453 }
454
455 const toolResult = toolUsePairs.get(content.id);
456 const isError = toolResult?.is_error === true;
457 const statusIcon = isError ? "✗" : "✓";
458
459 let displayName;
460 let resultPreview = "";
461
462 if (toolName === "Bash") {
463 const cmd = formatBashCommand(input.command || "");
464 displayName = `$ ${cmd}`;
465
466 if (toolResult && toolResult.content) {
467 const resultText = typeof toolResult.content === "string" ? toolResult.content : String(toolResult.content);
468 resultPreview = formatResultPreview(resultText);
469 }
470 } else if (toolName.startsWith("mcp__")) {
471 const formattedName = formatMcpName(toolName).replace("::", "-");
472 displayName = formatToolDisplayName(formattedName, input);
473
474 if (toolResult && toolResult.content) {
475 const resultText = typeof toolResult.content === "string" ? toolResult.content : JSON.stringify(toolResult.content);
476 resultPreview = formatResultPreview(resultText);
477 }
478 } else {
479 displayName = formatToolDisplayName(toolName, input);
480
481 if (toolResult && toolResult.content) {
482 const resultText = typeof toolResult.content === "string" ? toolResult.content : String(toolResult.content);
483 resultPreview = formatResultPreview(resultText);
484 }
485 }
486
487 state.traceEventCount += 1;
488 if (!appendConversationLine(lines, `[${state.traceEventCount}] ${statusIcon} ${displayName}`, state)) {
489 return;
490 }
491
492 if (resultPreview) {
493 for (const previewLine of resultPreview.split("\n")) {
494 if (!appendConversationLine(lines, previewLine, state)) {
495 return;
496 }
497 }
498 }
499
500 appendConversationLine(lines, "", state);
501 }
502
503 function appendStatistics(lines, logEntries, toolUsePairs) {
504 const lastEntry = logEntries[logEntries.length - 1];

Callers 1

generateSummaryLinesFunction · 0.85

Calls 6

formatBashCommandFunction · 0.85
formatResultPreviewFunction · 0.85
formatMcpNameFunction · 0.85
formatToolDisplayNameFunction · 0.85
appendConversationLineFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected