Skip to content

Commit 69d127f

Browse files
committed
use env variable to set file limit
1 parent 4d42f23 commit 69d127f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/seclab_taskflows/mcp_servers/local_file_viewer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
LOCAL_GH_DIR = mcp_data_dir('seclab-taskflows', 'local_file_viewer', 'LOCAL_GH_DIR')
2626

27+
LINE_LIMIT_FOR_FETCHING_FILE_CONTENT = int(os.getenv('LINE_LIMIT_FOR_FETCHING_FILE_CONTENT', default=1000))
28+
2729
def is_subdirectory(directory, potential_subdirectory):
2830
directory_path = Path(directory)
2931
potential_subdirectory_path = Path(potential_subdirectory)
@@ -106,7 +108,7 @@ async def fetch_file_content(
106108
if not source_path or not source_path.exists():
107109
return f"Invalid {owner} and {repo}. Check that the input is correct or try to fetch the repo from gh first."
108110
lines = get_file(source_path, path)
109-
if len(lines) > 1000:
111+
if len(lines) > LINE_LIMIT_FOR_FETCHING_FILE_CONTENT:
110112
return f"File {path} in {owner}/{repo} is too large to display ({len(lines)} lines). Please fetch specific lines using get_file_lines tool."
111113
if not lines:
112114
return f"Unable to find file {path} in {owner}/{repo}"

src/seclab_taskflows/toolboxes/local_file_viewer.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ server_params:
1111
args: ["-m", "seclab_taskflows.mcp_servers.local_file_viewer"]
1212
env:
1313
LOCAL_GH_DIR: "{{ env DATA_DIR }}"
14+
LINE_LIMIT_FOR_FETCHING_FILE_CONTENT: "{{ env LINE_LIMIT_FOR_FETCHING_FILE_CONTENT }}"

0 commit comments

Comments
 (0)