MCPcopy Create free account
hub / github.com/enowdev/enowX-Coder / truncate_tool_result

Function truncate_tool_result

src-tauri/src/agents/runner.rs:1883–1900  ·  view source on GitHub ↗
(output: &str)

Source from the content-addressed store, hash-verified

1881const MAX_TOOL_RESULT_CHARS: usize = 3000;
1882
1883fn truncate_tool_result(output: &str) -> String {
1884 if output.len() <= MAX_TOOL_RESULT_CHARS {
1885 return output.to_string();
1886 }
1887
1888 // Keep first and last portions for context
1889 let head_size = MAX_TOOL_RESULT_CHARS * 2 / 3; // ~2000 chars from start
1890 let tail_size = MAX_TOOL_RESULT_CHARS / 3; // ~1000 chars from end
1891
1892 let head = &output[..head_size];
1893 let tail = &output[output.len() - tail_size..];
1894 let omitted = output.len() - head_size - tail_size;
1895
1896 format!(
1897 "{}\n\n… [{} chars omitted] …\n\n{}",
1898 head, omitted, tail
1899 )
1900}
1901
1902/// Check if the user's message contains keywords that need the full PREVIEW_GUIDE
1903fn needs_full_preview_guide(task: &str) -> bool {

Callers 1

run_react_loopMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected