Skip to content

Commit 4d42f23

Browse files
committed
exit gracefully with large file
1 parent 10e6c8d commit 4d42f23

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/seclab_taskflows/mcp_servers/local_file_viewer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ async def fetch_file_content(
106106
if not source_path or not source_path.exists():
107107
return f"Invalid {owner} and {repo}. Check that the input is correct or try to fetch the repo from gh first."
108108
lines = get_file(source_path, path)
109+
if len(lines) > 1000:
110+
return f"File {path} in {owner}/{repo} is too large to display ({len(lines)} lines). Please fetch specific lines using get_file_lines tool."
109111
if not lines:
110112
return f"Unable to find file {path} in {owner}/{repo}"
111113
for i in range(len(lines)):

0 commit comments

Comments
 (0)