Skip to main content
Glama

create_dir

Destructive

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

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,
        }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The annotations already declare destructiveHint=true, indicating this is a mutation operation. The description adds useful context by specifying it creates files/folders in the workspace and mentions the return format. However, it doesn't disclose additional behavioral traits like permission requirements, what happens if the path already exists, or workspace-specific constraints beyond what annotations provide.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose. The Args and Returns sections are structured but slightly verbose. Every sentence adds value, though the formatting could be more streamlined without losing clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (destructive operation with 1 parameter), the description is reasonably complete. It explains the purpose, parameter, and return format. With an output schema present, it doesn't need to detail return values. However, it could better address behavioral aspects like error conditions or workspace boundaries.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates well by explaining the single parameter: 'path: Path to the folder to create.' This adds meaningful semantics beyond the bare schema. However, it doesn't clarify whether 'folder' includes files, path format requirements, or relative/absolute path handling, leaving some gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Create a file or folder in the workspace.' This specifies the verb ('create') and resource ('file or folder'), though it doesn't explicitly distinguish it from sibling tools like 'move_dir' or 'rename_file'. The 'Use instead of terminal' context is helpful but doesn't fully differentiate from alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear usage context with 'Use instead of terminal' and implies this is for workspace file/folder creation. However, it doesn't explicitly state when to use this tool versus alternatives like 'exec_make_target' or 'predefined_commands', nor does it mention any exclusions or prerequisites for use.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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