create_folder
Create a new folder in Proton Drive by specifying the desired path, enabling organized file storage and management through the Proton Drive MCP server.
Instructions
Create a new folder in Proton Drive
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Folder path relative to Proton Drive root |
Implementation Reference
- src/index.ts:390-410 (handler)The handler function for the 'create_folder' tool. It validates the input path using validatePath, creates the folder recursively using fs.promises.mkdir, and returns a success message with the relative path or throws an McpError on failure.case 'create_folder': { const folderPath = validatePath(args?.path as string); try { await mkdir(folderPath, { recursive: true }); return { content: [ { type: 'text', text: `Successfully created folder: ${getRelativePath(folderPath)}`, }, ], }; } catch (error: any) { throw new McpError( ErrorCode.InternalError, `Cannot create folder: ${error.message}` ); } }
- src/index.ts:191-204 (registration)Registration of the 'create_folder' tool in the ListTools response, including name, description, and input schema specifying a required 'path' string parameter.{ name: 'create_folder', description: 'Create a new folder in Proton Drive', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Folder path relative to Proton Drive root' }, }, required: ['path'], }, },
- src/index.ts:91-111 (helper)Helper function used by create_folder (and other tools) to validate and resolve relative paths to absolute paths within the Proton Drive root directory, preventing path traversal attacks.function validatePath(relativePath: string): string { // Handle empty path if (!relativePath) { return PROTON_DRIVE_PATH; } // Clean the path - remove leading slashes and normalize const cleaned = relativePath .split(/[/\\]+/) .filter(Boolean) .join(sep); const fullPath = resolve(PROTON_DRIVE_PATH, cleaned); // Security check - ensure we're still within Proton Drive if (!fullPath.startsWith(PROTON_DRIVE_PATH)) { throw new Error('Invalid path: Access denied outside Proton Drive'); } return fullPath; }