create_directory
Create a new directory at a specified path to organize Markdown files and content within the Markdown Editor MCP Server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Implementation Reference
- Core handler function in FileOperationsTool class that creates the directory using os.makedirs and handles errors.async def create_directory(self, path: str) -> Dict[str, Any]: """Create directory""" try: abs_path = self._get_abs_path(path) os.makedirs(abs_path, exist_ok=True) return {"success": True, "path": path} except Exception as e: return {"error": str(e)}
- src/markdown_editor/server.py:462-483 (registration)MCP tool registration defining the name, input schema (path required), and output schema.Tool( name="create_directory", title="Create Directory", inputSchema={ "type": "object", "properties": { "path": { "type": "string", "examples": ["./new_folder", "./docs/archive"] } }, "required": ["path"], "additionalProperties": False }, outputSchema={ "type": "object", "properties": { "success": {"type": "boolean"}, "path": {"type": "string"} } } ),
- src/markdown_editor/server.py:533-535 (handler)Tool dispatcher in the main call_tool handler that calls the create_directory function.elif name == "create_directory": res = await create_directory(arguments["path"]) return {"content": [TextContent(type="text", text="Directory created")], "structuredContent": res, "isError": "error" in res}
- Top-level wrapper function imported by server.py that delegates to the class instance method.async def create_directory(path: str): return await _instance.create_directory(path)
- Singleton instance of FileOperationsTool used by all wrapper functions.# Global instance _instance = FileOperationsTool()