MCPcopy Create free account
hub / github.com/Noumena-Network/code / formatModelToolResult

Function formatModelToolResult

src/tools/REPLTool/javascriptReplFactory.tsx:327–357  ·  view source on GitHub ↗
(output: Output)

Source from the content-addressed store, hash-verified

325}
326
327function formatModelToolResult(output: Output): string {
328 const lines: string[] = []
329 lines.push(
330 output.error
331 ? 'JavaScript REPL execution failed.'
332 : 'JavaScript REPL execution completed.',
333 )
334
335 if (output.toolCalls.length > 0) {
336 lines.push(`Inner tool calls (${output.toolCalls.length}):`)
337 for (const call of output.toolCalls) {
338 lines.push(`- ${formatToolCallSummary(call)}`)
339 }
340 } else {
341 lines.push('Inner tool calls: none')
342 }
343
344 if (output.stdout.trim().length > 0) {
345 lines.push(`stdout:\n${preview(output.stdout)}`)
346 }
347 if (output.stderr.trim().length > 0) {
348 lines.push(`stderr:\n${preview(output.stderr)}`)
349 }
350 if (output.error) {
351 lines.push(`error:\n${output.error}`)
352 } else if ('result' in output) {
353 lines.push(`result:\n${preview(stringifyUnknown(output.result))}`)
354 }
355
356 return lines.join('\n\n')
357}
358
359function renderProgressHint(data: ReplToolCallProgress): string {
360 if (data.phase !== 'start') {

Callers 1

Calls 3

formatToolCallSummaryFunction · 0.70
previewFunction · 0.70
stringifyUnknownFunction · 0.70

Tested by

no test coverage detected