File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change 2424
2525LOCAL_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+
2729def is_subdirectory (directory , potential_subdirectory ):
2830 directory_path = Path (directory )
2931 potential_subdirectory_path = Path (potential_subdirectory )
@@ -106,6 +108,8 @@ 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 )
111+ if len (lines ) > LINE_LIMIT_FOR_FETCHING_FILE_CONTENT :
112+ return f"File { path } in { owner } /{ repo } is too large to display ({ len (lines )} lines). Please fetch specific lines using get_file_lines tool."
109113 if not lines :
110114 return f"Unable to find file { path } in { owner } /{ repo } "
111115 for i in range (len (lines )):
Original file line number Diff line number Diff 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 }}"
You can’t perform that action at this time.
0 commit comments