MCPcopy
hub / github.com/HKUDS/DeepCode / read_code_mem

Function read_code_mem

tools/code_implementation_server.py:853–983  ·  view source on GitHub ↗

Check if file summaries exist in implement_code_summary.md for multiple files Args: file_paths: List of file paths to check for summary information in implement_code_summary.md Returns: Summary information for all requested files if available

(file_paths: List[str])

Source from the content-addressed store, hash-verified

851
852@mcp.tool()
853async def read_code_mem(file_paths: List[str]) -> str:
854 """
855 Check if file summaries exist in implement_code_summary.md for multiple files
856
857 Args:
858 file_paths: List of file paths to check for summary information in implement_code_summary.md
859
860 Returns:
861 Summary information for all requested files if available
862 """
863 try:
864 if not file_paths or not isinstance(file_paths, list):
865 result = {
866 "status": "error",
867 "message": "file_paths parameter is required and must be a list",
868 }
869 log_operation(
870 "read_code_mem_error", {"error": "missing_or_invalid_file_paths"}
871 )
872 return json.dumps(result, ensure_ascii=False, indent=2)
873
874 # Remove duplicates while preserving order
875 unique_file_paths = list(dict.fromkeys(file_paths))
876
877 # Ensure workspace exists
878 ensure_workspace_exists()
879
880 # Look for implement_code_summary.md in the workspace
881 current_path = Path(WORKSPACE_DIR)
882 summary_file_path = current_path.parent / "implement_code_summary.md"
883
884 if not summary_file_path.exists():
885 result = {
886 "status": "no_summary",
887 "file_paths": unique_file_paths,
888 "message": "No summary file found.",
889 "results": [],
890 }
891 log_operation(
892 "read_code_mem",
893 {"file_paths": unique_file_paths, "status": "no_summary_file"},
894 )
895 return json.dumps(result, ensure_ascii=False, indent=2)
896
897 # Read the summary file
898 with open(summary_file_path, "r", encoding="utf-8") as f:
899 summary_content = f.read()
900
901 if not summary_content.strip():
902 result = {
903 "status": "no_summary",
904 "file_paths": unique_file_paths,
905 "message": "Summary file is empty.",
906 "results": [],
907 }
908 log_operation(
909 "read_code_mem",
910 {"file_paths": unique_file_paths, "status": "empty_summary"},

Callers

nothing calls this directly

Calls 3

log_operationFunction · 0.85
ensure_workspace_existsFunction · 0.85

Tested by

no test coverage detected