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

Function formatToolCallMd

apps/kimi-code/src/tui/utils/export-markdown.ts:57–73  ·  view source on GitHub ↗
(tc: ToolCall)

Source from the content-addressed store, hash-verified

55}
56
57export function formatToolCallMd(tc: ToolCall): string {
58 const argsRaw = tc.arguments ?? '{}';
59 const hint = extractToolCallHint(argsRaw);
60 let title = `#### Tool Call: ${tc.name}`;
61 if (hint) {
62 title += ` (\`${hint}\`)`;
63 }
64
65 let argsFormatted: string;
66 try {
67 argsFormatted = JSON.stringify(JSON.parse(argsRaw), null, 2);
68 } catch {
69 argsFormatted = argsRaw;
70 }
71
72 return `${title}\n<!-- call_id: ${tc.id} -->\n\`\`\`json\n${argsFormatted}\n\`\`\``;
73}
74
75function formatToolResultMd(msg: ContextMessage, toolName: string, hint: string): string {
76 const callId = msg.toolCallId ?? 'unknown';

Callers 2

formatTurnMdFunction · 0.85

Calls 1

extractToolCallHintFunction · 0.85

Tested by

no test coverage detected