Skip to main content
Glama
abhishekbhakat

mcp-server-code-assist

create_directory

Create new directories to organize files and code projects. Specify the path where the directory should be created to structure your workspace.

Instructions

Creates a new directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • The core handler function in DirTools that validates the path, creates the directory using pathlib.mkdir with parents and exist_ok, returns success message or handles errors.
    async def create_directory(self, path: str) -> str:
        """Create a new directory.
    
        Args:
            path: Directory path to create
    
        Returns:
            Success message
        """
        path = await self.validate_path(path)
        try:
            path.mkdir(parents=True, exist_ok=True)
            return f"Created directory: {path}"
        except Exception as e:
            self.handle_error(e, {"operation": "create_directory", "path": str(path)})
  • Pydantic model defining the input schema for the create_directory tool, with a single 'path' field accepting str or Path.
    class CreateDirectory(BaseModel):
        path: str | Path
  • Registration of the create_directory tool in the MCP server's list_tools() method, specifying name, description, and input schema.
    Tool(
        name=CodeAssistTools.CREATE_DIRECTORY,
        description="Creates a new directory",
        inputSchema=CreateDirectory.model_json_schema(),
    ),
  • Dispatch handler in the MCP server's call_tool() method that parses arguments into the model and invokes the DirTools.create_directory implementation.
    case CodeAssistTools.CREATE_DIRECTORY:
        model = CreateDirectory(path=arguments["path"])
        result = await dir_tools.create_directory(model.path)
        return [TextContent(type="text", text=result)]
  • Helper method used by create_directory to validate and resolve the path, ensuring it's within allowed directories.
    async def validate_path(self, path: str) -> Path:
        """Validate and resolve path.
    
        Args:
            path: Path to validate
    
        Returns:
            Resolved Path object
    
        Raises:
            ValueError: If path is outside allowed directories
        """
        abs_path = os.path.abspath(path)
        if not any(abs_path.startswith(p) for p in self.allowed_paths):
            raise ValueError(f"Path {path} is outside allowed directories")
        return Path(abs_path)
Behavior1/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('creates') but fails to describe critical traits: whether this requires specific permissions, if it overwrites existing directories, what happens on success or error (e.g., returns a path or error message), or any rate limits. This is inadequate for a mutation tool with zero annotation coverage.

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

Conciseness5/5

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

The description is extremely concise with a single sentence ('Creates a new directory'), which is front-loaded and wastes no words. However, this conciseness comes at the cost of under-specification, but per the scoring rules, it earns full points for brevity and structure.

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

Completeness1/5

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

Given the tool's complexity (a mutation operation with no annotations), low schema coverage (0%), and no output schema, the description is completely inadequate. It lacks essential details: parameter meaning, behavioral traits, usage context, and expected outcomes. For a tool that creates directories—a potentially destructive or permission-sensitive action—this leaves the agent ill-equipped to use it correctly.

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

Parameters1/5

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

The schema description coverage is 0%, meaning the parameter 'path' is undocumented in the schema. The description adds no information about this parameter—it does not explain what 'path' represents (e.g., absolute or relative path, format requirements like slashes), valid values, or examples. With one required parameter and no compensation in the description, this is a significant gap.

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

Purpose2/5

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

The description 'Creates a new directory' is essentially a tautology that restates the tool name 'create_directory' with minimal elaboration. While it does specify the verb ('creates') and resource ('directory'), it lacks any distinguishing details from sibling tools like 'create_file' or specificity about what constitutes a directory in this context.

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

Usage Guidelines1/5

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

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites (e.g., permissions, existing parent directories), exclusions (e.g., cannot create nested directories in one call), or comparisons to siblings like 'create_file' or 'list_directory'. This leaves the agent without context for tool selection.

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

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/abhishekbhakat/mcp_server_code_assist'

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