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

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

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