Skip to main content
Glama

create_dir

Create files or folders in the workspace by specifying a target path, eliminating the need for manual terminal commands. Returns status and path details for the created items.

Instructions

Use instead of terminal: Create a file or folder in the workspace.

Args: path: Path to the folder to create Returns: A dictionary containing the status and path of the created file or folder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • The CreateDirOperation class implements the core logic for the 'create_dir' tool. It validates the path is within the root directory, checks if it exists, and creates the directory (including parents) using Path.mkdir. The __call__ method handles the tool execution and returns a success response.
    @dataclass class CreateDirOperation(AsyncOperation): """Class to create a folder in the workspace.""" name = "create_dir" def _create_folder(self, path: str) -> None: """Create a folder at the specified path. Args: path: Path to the folder to create Raises: FileExistsError: If the path already exists """ # Validate that the path is within the root directory root_path = self._root_path abs_path = self._validate_path_in_root(root_path, path) # Create the folder folder_path = Path(abs_path) if folder_path.exists(): raise FileExistsError(f"Path already exists: {path}") # Create parent directories if they don't exist folder_path.mkdir(parents=True, exist_ok=False) async def __call__(self, path: str) -> Dict[str, Any]: """Create a file or folder in the workspace. Args: path: Path to the folder to create Returns: A dictionary containing the status and path of the created file or folder """ # Handle both model and direct path input for backward compatibility self._create_folder(path) return { "status": "success", "message": f"Successfully created folder: {path}", "path": path, }
  • In server_init, the ToolFactory registers all AsyncOperation tools from the 'dev_kit_mcp_server.tools' package, which includes the CreateDirOperation for 'create_dir'.
    # Register all tools tool_factory = ToolFactory(fastmcp) tool_factory(["dev_kit_mcp_server.tools"], root_dir=root_dir, commands_toml=commands_toml) return fastmcp
  • The input schema is defined by the __call__ method signature: single string parameter 'path', returns Dict[str, Any] with status, message, path.
    async def __call__(self, path: str) -> Dict[str, Any]: """Create a file or folder in the workspace. Args: path: Path to the folder to create Returns: A dictionary containing the status and path of the created file or folder """ # Handle both model and direct path input for backward compatibility self._create_folder(path) return { "status": "success", "message": f"Successfully created folder: {path}", "path": path, }

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/DanielAvdar/dev-kit-mcp-server'

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