Skip to content

Commit 69480a6

Browse files
authored
πŸ› fix: improve fs_read error message with file count (#796)
* πŸ› fix: improve fs_read error message with file count When fs_read exceeds the maximum tool response size, include the number of files in the error message to provide better context for troubleshooting. This helps users understand why the operation failed and how to adjust their request. * πŸ› fix: improve fs_read error message with file count When fs_read exceeds the maximum tool response size, include the number of files in the error message to provide better context for troubleshooting. This helps users understand why the operation failed and how to adjust their request.
1 parent a57946a commit 69480a6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

β€Žcrates/q_cli/src/cli/chat/tools/fs_read.rsβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,12 @@ impl FsRead {
186186
}
187187
}
188188

189+
let file_count = result.len();
189190
let result = result.join("\n");
190191
let byte_count = result.len();
191192
if byte_count > MAX_TOOL_RESPONSE_SIZE {
192193
bail!(
193-
"This tool only supports reading up to {MAX_TOOL_RESPONSE_SIZE} bytes at a time. You tried to read {byte_count} bytes. Try executing with fewer lines specified."
194+
"This tool only supports reading up to {MAX_TOOL_RESPONSE_SIZE} bytes at a time. You tried to read {byte_count} bytes ({file_count} files). Try executing with fewer lines specified."
194195
);
195196
}
196197

0 commit comments

Comments
Β (0)