Skip to main content
Glama
anyrxo
by anyrxo

delete_file

Remove a file or folder from Proton Drive by specifying its path. Use this tool to manage and organize your Proton Drive storage effectively.

Instructions

Delete a file or folder from Proton Drive

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to delete relative to Proton Drive root

Implementation Reference

  • The handler for the 'delete_file' tool. Validates the path, determines if it's a file or directory, deletes using unlink for files or rm (recursive) for directories, and returns a success message or throws an error.
    case 'delete_file': { const deletePath = validatePath(args?.path as string); try { const stats = await stat(deletePath); if (stats.isDirectory()) { await rm(deletePath, { recursive: true, force: true }); } else { await unlink(deletePath); } return { content: [ { type: 'text', text: `Successfully deleted: ${getRelativePath(deletePath)}`, }, ], }; } catch (error: any) { throw new McpError( ErrorCode.InternalError, `Cannot delete: ${error.message}` ); } }
  • src/index.ts:177-190 (registration)
    Registration of the 'delete_file' tool in the list_tools response, including name, description, and input schema requiring a 'path' parameter.
    { name: 'delete_file', description: 'Delete a file or folder from Proton Drive', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path to delete relative to Proton Drive root' }, }, required: ['path'], }, },
  • Input schema for the 'delete_file' tool, defining an object with a required 'path' string property.
    inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path to delete relative to Proton Drive root' }, }, required: ['path'], },
  • Helper function validatePath used by delete_file to ensure the path is within the Proton Drive directory and secure.
    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; }

Other Tools

Related Tools

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