MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / formatPersistedOutput

Function formatPersistedOutput

src/core/tools/ExecuteCommandTool.ts:597–616  ·  view source on GitHub ↗

* Format persisted output result for tool response when output was truncated

(
	result: PersistedCommandOutput,
	exitDetails: ExitCodeDetails | undefined,
	workingDir: string,
)

Source from the content-addressed store, hash-verified

595 * Format persisted output result for tool response when output was truncated
596 */
597function formatPersistedOutput(
598 result: PersistedCommandOutput,
599 exitDetails: ExitCodeDetails | undefined,
600 workingDir: string,
601): string {
602 const exitStatus = formatExitStatus(exitDetails)
603 const sizeStr = formatBytes(result.totalBytes)
604 const artifactId = result.artifactPath ? path.basename(result.artifactPath) : ""
605
606 return [
607 `Command executed in '${workingDir}'. ${exitStatus}`,
608 "",
609 `Output (${sizeStr}) persisted. Artifact ID: ${artifactId}`,
610 "",
611 "Preview:",
612 result.preview,
613 "",
614 "Use read_command_output tool to view full output if needed.",
615 ].join("\n")
616}
617
618/**
619 * Format bytes to human-readable string

Callers 1

executeCommandInTerminalFunction · 0.85

Calls 2

formatExitStatusFunction · 0.85
formatBytesFunction · 0.70

Tested by

no test coverage detected