listdir
Lists files and directories in a specified folder path to help users navigate and manage file systems within the editor-mcp server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dirpath | Yes |
Implementation Reference
- src/text_editor/server.py:891-906 (handler)The handler function for the 'listdir' tool. It lists the contents of the specified directory using os.listdir() and returns the filenames along with the path. Handles cases where the path is not a directory or other exceptions occur.async def listdir(dirpath: str) -> Dict[str, Any]: try: return { "filenames": os.listdir(dirpath), "path": dirpath, } except NotADirectoryError as e: return { "error": "Specified path is not a directory.", "path": dirpath, } except Exception as e: return { "error": f"Unexpected error when listing the directory: {str(e)}" }