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

Function formatCodexToolCall

actions/setup/js/parse_codex_log.cjs:877–914  ·  view source on GitHub ↗

* Format a Codex tool call with HTML details * Uses the shared formatToolCallAsDetails helper for consistent rendering across all engines. * @param {string} server - The server name (e.g., "github", "time") * @param {string} toolName - The tool name (e.g., "list_pull_requests") * @param {string}

(server, toolName, params, response, statusIcon)

Source from the content-addressed store, hash-verified

875 * @returns {string} Formatted HTML details string
876 */
877function formatCodexToolCall(server, toolName, params, response, statusIcon) {
878 // Calculate token estimate from params + response
879 const totalTokens = estimateTokens(params) + estimateTokens(response);
880
881 // Format metadata
882 let metadata = "";
883 if (totalTokens > 0) {
884 metadata = `<code>~${totalTokens}t</code>`;
885 }
886
887 const summary = `<code>${server}::${toolName}</code>`;
888
889 // Build sections array
890 const sections = [];
891
892 if (params && params.trim()) {
893 sections.push({
894 label: "Parameters",
895 content: params,
896 language: "json",
897 });
898 }
899
900 if (response && response.trim()) {
901 sections.push({
902 label: "Response",
903 content: response,
904 language: "json",
905 });
906 }
907
908 return formatToolCallAsDetails({
909 summary,
910 statusIcon,
911 metadata,
912 sections,
913 });
914}
915
916/**
917 * Format a Codex bash call with HTML details

Callers 3

parseCodexJsonlFunction · 0.85
parseCodexLogFunction · 0.85

Calls 2

formatToolCallAsDetailsFunction · 0.85
estimateTokensFunction · 0.70

Tested by

no test coverage detected