Skip to main content
Glama
Preston-Harrison

Filesystem MCP Server

create_directory

Creates directories with automatic parent directory generation for organized file system management. Specify a path to build directory structures within allowed sandboxed areas.

Instructions

Create a directory, including any necessary parent directories.

Args: path (str): Directory path to create (absolute or relative to allowed directories)

Returns: str: Success message with created directory path, or error message if failed

Note: - Path must be within allowed directory roots - Creates parent directories if they don't exist - No error if directory already exists

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:382-402 (handler)
    The handler function for the 'create_directory' tool. It resolves the path to ensure it's within allowed directories, creates the directory (and parents) using pathlib.Path.mkdir(parents=True, exist_ok=True), and returns a success message or human-readable error.
    def create_directory(path: str) -> str:
        """Create a directory, including any necessary parent directories.
    
        Args:
            path (str): Directory path to create (absolute or relative to allowed directories)
    
        Returns:
            str: Success message with created directory path, or error message if failed
    
        Note:
            - Path must be within allowed directory roots
            - Creates parent directories if they don't exist
            - No error if directory already exists
        """
        try:
            rp = _resolve(path)
            rp.mkdir(parents=True, exist_ok=True)
            return f"Ensured directory {rp}"
        except Exception as e:
            return _human_error(e, "creating directory")
  • The docstring provides the input schema (path: str) and output schema (str: success or error message), along with notes on behavior.
    """Create a directory, including any necessary parent directories.
    
    Args:
        path (str): Directory path to create (absolute or relative to allowed directories)
    
    Returns:
        str: Success message with created directory path, or error message if failed
    
    Note:
        - Path must be within allowed directory roots
        - Creates parent directories if they don't exist
        - No error if directory already exists
    """
  • main.py:381-381 (registration)
    The @mcp.tool decorator registers the create_directory function as an MCP tool, conditional on not being in read-only mode (line 379).
    @mcp.tool
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: it creates parent directories if missing, doesn't error if the directory already exists, and has path restrictions (must be within allowed roots). It also mentions the return value (success/error message). The only minor gap is lack of explicit permission or rate limit details.

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 well-structured and front-loaded with the core purpose. Every sentence earns its place: the first states the action, the 'Args' and 'Returns' sections clarify I/O, and the 'Note' bullets add critical behavioral details without redundancy. It's appropriately sized for a single-parameter tool.

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

Completeness5/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 (creation with parent directories), no annotations, and an output schema that documents the return type, the description is complete. It covers purpose, parameter semantics, behavioral traits, and usage context, leaving no significant gaps for the agent to operate effectively.

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

Parameters5/5

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

The schema description coverage is 0%, so the description must fully compensate. It provides detailed semantics for the single parameter 'path': it's a directory path (str), can be absolute or relative to allowed directories, and has constraints (must be within allowed roots). This adds substantial meaning beyond the bare schema.

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

Purpose5/5

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

The description clearly states the specific action ('Create a directory') and resource ('directory'), distinguishing it from sibling tools like 'create_file' (creates files) and 'directory_tree' (lists structure). It explicitly mentions creating parent directories, which further differentiates its functionality from simple directory creation tools.

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 context for when to use this tool (to create directories with parent creation) and includes a note about path constraints. However, it doesn't explicitly state when NOT to use it or name alternatives (e.g., using 'create_file' for files instead), which prevents a perfect score.

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/Preston-Harrison/fs-mcp-py'

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