MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / formatToolResultMd

Function formatToolResultMd

apps/kimi-code/src/tui/utils/export-markdown.ts:75–93  ·  view source on GitHub ↗
(msg: ContextMessage, toolName: string, hint: string)

Source from the content-addressed store, hash-verified

73}
74
75function formatToolResultMd(msg: ContextMessage, toolName: string, hint: string): string {
76 const callId = msg.toolCallId ?? 'unknown';
77 const parts: string[] = [];
78 for (const part of msg.content) {
79 const text = formatContentPartMd(part);
80 if (text.trim()) parts.push(text);
81 }
82 const resultText = parts.join('\n');
83
84 let summary = `Tool Result: ${toolName}`;
85 if (hint) summary += ` (\`${hint}\`)`;
86
87 return (
88 `<details><summary>${summary}</summary>\n\n` +
89 `<!-- call_id: ${callId} -->\n` +
90 `${resultText}\n\n` +
91 '</details>'
92 );
93}
94
95const INTERNAL_ORIGINS = new Set<PromptOrigin['kind']>([
96 'injection',

Callers 1

formatTurnMdFunction · 0.85

Calls 2

formatContentPartMdFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected