MCPcopy Index your code
hub / github.com/HKUDS/DeepCode / validate_path

Function validate_path

tools/code_implementation_server.py:92–100  ·  view source on GitHub ↗

Validate if path is within workspace

(path: str)

Source from the content-addressed store, hash-verified

90
91
92def validate_path(path: str) -> Path:
93 """Validate if path is within workspace"""
94 if WORKSPACE_DIR is None:
95 initialize_workspace()
96
97 full_path = (WORKSPACE_DIR / path).resolve()
98 if not str(full_path).startswith(str(WORKSPACE_DIR)):
99 raise ValueError(f"Path {path} is outside workspace scope")
100 return full_path
101
102
103def log_operation(action: str, details: Dict[str, Any]):

Callers 5

read_fileFunction · 0.85
read_multiple_filesFunction · 0.85
write_fileFunction · 0.85
write_multiple_filesFunction · 0.85
get_file_structureFunction · 0.85

Calls 1

initialize_workspaceFunction · 0.85

Tested by

no test coverage detected