Skip to main content
Glama
anyrxo

Proton Drive MCP

by anyrxo

get_file_info

Retrieve details about Proton Drive files and folders, including metadata and properties, by specifying the file path.

Instructions

Get information about a file or folder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the file or folder

Implementation Reference

  • The handler logic for the 'get_file_info' tool, which validates the path, retrieves file stats, formats the information, and returns it as JSON.
    case 'get_file_info': {
      const infoPath = validatePath(args?.path as string);
      
      try {
        const stats = await stat(infoPath);
        const relativePath = getRelativePath(infoPath);
        
        const info = {
          path: relativePath,
          name: basename(infoPath),
          type: stats.isDirectory() ? 'folder' : 'file',
          size: stats.size,
          sizeFormatted: formatBytes(stats.size),
          created: stats.birthtime.toISOString(),
          modified: stats.mtime.toISOString(),
          accessed: stats.atime.toISOString(),
        };
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(info, null, 2),
            },
          ],
        };
      } catch (error: any) {
        throw new McpError(
          ErrorCode.InternalError,
          `Cannot get file info: ${error.message}`
        );
      }
    }
  • The input schema definition for the 'get_file_info' tool, specifying a required 'path' parameter.
    inputSchema: {
      type: 'object',
      properties: {
        path: { 
          type: 'string', 
          description: 'Path to the file or folder' 
        },
      },
      required: ['path'],
    },
  • src/index.ts:205-218 (registration)
    The tool registration in the ListTools response, including name, description, and schema.
    {
      name: 'get_file_info',
      description: 'Get information about a file or folder',
      inputSchema: {
        type: 'object',
        properties: {
          path: { 
            type: 'string', 
            description: 'Path to the file or folder' 
          },
        },
        required: ['path'],
      },
    },
  • Helper function to format file size in human-readable bytes, used in get_file_info.
    function formatBytes(bytes: number): string {
      if (bytes === 0) return '0 Bytes';
      
      const k = 1024;
      const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
      const i = Math.floor(Math.log(bytes) / Math.log(k));
      
      return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
    }

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