Skip to main content
Glama
anyrxo

Proton Drive MCP

by anyrxo

write_file

Create or update text files directly in Proton Drive by specifying a file path and content, enabling secure file management through AI assistants.

Instructions

Write or create a file in Proton Drive

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile path relative to Proton Drive root
contentYesText content to write to the file

Implementation Reference

  • Handler function for the 'write_file' tool: validates path, ensures parent directories exist, writes file content using Node.js fs/promises.writeFile, and returns success message or throws error.
    case 'write_file': {
      const writePath = validatePath(args?.path as string);
      const content = args?.content as string;
      
      try {
        // Create directory if needed
        await mkdir(dirname(writePath), { recursive: true });
        
        // Write the file
        await writeFile(writePath, content, 'utf-8');
        
        return {
          content: [
            {
              type: 'text',
              text: `Successfully wrote file: ${getRelativePath(writePath)}`,
            },
          ],
        };
      } catch (error: any) {
        throw new McpError(
          ErrorCode.InternalError,
          `Cannot write file: ${error.message}`
        );
      }
    }
  • Input schema for the 'write_file' tool defining required 'path' and 'content' string parameters.
    inputSchema: {
      type: 'object',
      properties: {
        path: { 
          type: 'string', 
          description: 'File path relative to Proton Drive root' 
        },
        content: { 
          type: 'string', 
          description: 'Text content to write to the file' 
        },
      },
      required: ['path', 'content'],
    },
  • src/index.ts:159-176 (registration)
    Registration of the 'write_file' tool in the ListTools response, including name, description, and input schema.
    {
      name: 'write_file',
      description: 'Write or create a file in Proton Drive',
      inputSchema: {
        type: 'object',
        properties: {
          path: { 
            type: 'string', 
            description: 'File path relative to Proton Drive root' 
          },
          content: { 
            type: 'string', 
            description: 'Text content to write to the file' 
          },
        },
        required: ['path', 'content'],
      },
    },
  • Helper function validatePath used in write_file handler to resolve and secure the file path within Proton Drive root.
    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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool writes or creates files but fails to specify critical details: whether it overwrites existing files, requires specific permissions, handles errors (e.g., invalid paths), or has rate limits. This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without any fluff or redundancy. It is appropriately sized and front-loaded, making it easy to parse quickly, which is ideal for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a file write operation with no annotations and no output schema, the description is insufficient. It doesn't explain return values, error conditions, or behavioral nuances like overwriting, which are critical for safe and effective use. This leaves the agent under-informed for a mutation task.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting both parameters ('path' and 'content'). The description adds no additional semantic context beyond implying file creation/writing, so it meets the baseline of 3 where the schema does the heavy lifting without extra value from the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Write or create') and resource ('a file in Proton Drive'), making the purpose immediately understandable. However, it doesn't differentiate this tool from potential sibling operations like 'create_folder' or 'delete_file' beyond the obvious file vs. folder distinction, which keeps it from a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'create_folder' for directories or 'read_file' for retrieval. It lacks any mention of prerequisites, such as whether the parent directory must exist, or exclusions, like handling existing files, leaving the agent with minimal contextual direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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