make_directory
Create a directory inside the MCP_FILE_OPS_ROOT path to organize files.
Instructions
Create a directory inside MCP_FILE_OPS_ROOT.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- server.py:111-116 (handler)The 'make_directory' tool handler. Decorated with @mcp.tool(), it resolves the path through _resolve_file_ops_path, creates the directory with mkdir(parents=True, exist_ok=True), and returns a confirmation string.
@mcp.tool() def make_directory(path: str) -> str: """Create a directory inside MCP_FILE_OPS_ROOT.""" target = _resolve_file_ops_path(path) target.mkdir(parents=True, exist_ok=True) return f"Created directory: {target}" - server.py:111-112 (registration)Registration of 'make_directory' as an MCP tool via the @mcp.tool() decorator on the function.
@mcp.tool() def make_directory(path: str) -> str: - server.py:66-76 (helper)The _resolve_file_ops_path helper used by make_directory to resolve and validate the path against MCP_FILE_OPS_ROOT.
def _resolve_file_ops_path(path: str | None = None) -> Path: if not FILE_OPS_ROOT: raise ValueError("MCP_FILE_OPS_ROOT is not configured in .env.") root = Path(FILE_OPS_ROOT).expanduser().resolve() root.mkdir(parents=True, exist_ok=True) target = root if path is None else (root / path).resolve() if target != root and root not in target.parents: raise ValueError("Path escapes the configured MCP_FILE_OPS_ROOT.") return target