MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / truncate_result

Function truncate_result

atomic-repository/src/ai/tools.rs:1151–1158  ·  view source on GitHub ↗

Truncate a tool result to [`MAX_TOOL_RESULT_BYTES`].

(s: &str)

Source from the content-addressed store, hash-verified

1149
1150/// Truncate a tool result to [`MAX_TOOL_RESULT_BYTES`].
1151fn truncate_result(s: &str) -> String {
1152 if s.len() <= MAX_TOOL_RESULT_BYTES {
1153 s.to_string()
1154 } else {
1155 let truncated = &s[..MAX_TOOL_RESULT_BYTES];
1156 format!("{truncated}\n\n... truncated ({} bytes total)", s.len())
1157 }
1158}
1159
1160/// Generate a short preview for [`ToolTraceEntry`].
1161fn preview(s: &str) -> String {

Callers 2

run_tool_loopFunction · 0.85

Calls 1

lenMethod · 0.45

Tested by 1