Skip to main content
Glama

listdir

Retrieve a list of files and directories within a specified path using the 'listdir' tool on the editor-mcp server, enabling efficient file management and navigation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dirpathYes

Implementation Reference

  • The handler function for the 'listdir' tool that lists directory contents using os.listdir and handles errors.
    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)}" }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/danielpodrazka/editor-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server