create_folder
Create new folders in Proton Drive to organize files and documents. Specify the folder path to establish directory structure for better file management.
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)Handler for the 'create_folder' tool. Validates the path using validatePath helper, creates the folder using mkdir (recursive), and returns success message or throws error.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 description and input schema requiring a 'path' 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:194-203 (schema)Input schema for the 'create_folder' tool: object with required 'path' string.inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Folder path relative to Proton Drive root' }, }, required: ['path'], },
- src/index.ts:91-111 (helper)validatePath helper function used by create_folder to secure and resolve the relative folder path to absolute path within Proton Drive.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; }