Skip to main content
Glama
anyrxo

Proton Drive MCP

by anyrxo

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
NameRequiredDescriptionDefault
pathYesFolder path relative to Proton Drive root

Implementation Reference

  • 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'],
      },
    },
  • 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'],
    },
  • 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;
    }

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/anyrxo/proton-drive-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server