Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/seclab_taskflows/mcp_servers/local_file_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

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

LINE_LIMIT_FOR_FETCHING_FILE_CONTENT = int(os.getenv('LINE_LIMIT_FOR_FETCHING_FILE_CONTENT', default=1000))

def is_subdirectory(directory, potential_subdirectory):
directory_path = Path(directory)
potential_subdirectory_path = Path(potential_subdirectory)
Expand Down Expand Up @@ -106,6 +108,8 @@ async def fetch_file_content(
if not source_path or not source_path.exists():
return f"Invalid {owner} and {repo}. Check that the input is correct or try to fetch the repo from gh first."
lines = get_file(source_path, path)
if len(lines) > LINE_LIMIT_FOR_FETCHING_FILE_CONTENT:
return f"File {path} in {owner}/{repo} is too large to display ({len(lines)} lines). Please fetch specific lines using get_file_lines tool."
if not lines:
return f"Unable to find file {path} in {owner}/{repo}"
for i in range(len(lines)):
Expand Down
1 change: 1 addition & 0 deletions src/seclab_taskflows/toolboxes/local_file_viewer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ server_params:
args: ["-m", "seclab_taskflows.mcp_servers.local_file_viewer"]
env:
LOCAL_GH_DIR: "{{ env DATA_DIR }}"
LINE_LIMIT_FOR_FETCHING_FILE_CONTENT: "{{ env LINE_LIMIT_FOR_FETCHING_FILE_CONTENT }}"