Skip to main content

compress_tool_output

Function compress_tool_output 

Source
pub fn compress_tool_output(
    content: &str,
    threshold: usize,
) -> ToolOutputCompression
Expand description

Compress tool output based on a byte-length threshold.

When content.len() is at or below threshold, returns the content unchanged with raw_flag = 0.

When content.len() exceeds threshold, returns a summary consisting of the first threshold characters followed by a truncation notice, and stores the original content in raw_content with raw_flag = 1.