MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / tool_list_dir

Function tool_list_dir

tools/file_tools.py:191–213  ·  view source on GitHub ↗

List directory contents. Args: path: Directory path (default: current directory) Returns: Formatted list of entries or error message

(path: str = ".")

Source from the content-addressed store, hash-verified

189
190
191def tool_list_dir(path: str = ".") -> str:
192 """
193 List directory contents.
194
195 Args:
196 path: Directory path (default: current directory)
197
198 Returns:
199 Formatted list of entries or error message
200 """
201 try:
202 entries = _get_fs().list_dir(path)
203 # Format as multi-line string
204 lines = []
205 for entry in entries:
206 full_path = Path(path) / entry
207 if full_path.is_dir():
208 lines.append(f"📁 {entry}/")
209 else:
210 lines.append(f"📄 {entry}")
211 return "\n".join(lines)
212 except FilesystemAccessError as e:
213 return f"[ERROR] {e}"
214
215
216def file_exists(path: str) -> bool:

Callers 1

agent.pyFile · 0.90

Calls 4

_get_fsFunction · 0.85
list_dirMethod · 0.80
is_dirMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected