List directory contents. Args: path: Directory path (default: current directory) Returns: Formatted list of entries or error message
(path: str = ".")
| 189 | |
| 190 | |
| 191 | def 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 | |
| 216 | def file_exists(path: str) -> bool: |