Skip to main content
Glama
cindyloo

Dropbox MCP Server

by cindyloo

get_file_info

Retrieve detailed metadata and properties for any file stored in Dropbox to understand file characteristics, size, and modification details.

Instructions

Get detailed information about a specific file.

Args: file_path: Full path to the file in Dropbox

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes

Implementation Reference

  • The core handler function for the 'get_file_info' MCP tool. It uses the Dropbox API to retrieve file metadata and constructs a FileInfo object, handling both files and folders.
    @mcp.tool()
    def get_file_info(file_path: str) -> FileInfo:
        """
        Get detailed information about a specific file.
        
        Args:
            file_path: Full path to the file in Dropbox
        """
        if not dropbox_client:
            initialize_dropbox_client()
        
        try:
            metadata = dropbox_client.files_get_metadata(file_path)
            
            if isinstance(metadata, dropbox.files.FileMetadata):
                return FileInfo(
                    name=metadata.name,
                    path=metadata.path_lower,
                    size=metadata.size,
                    modified=metadata.server_modified.isoformat(),
                    is_folder=False
                )
            else:
                return FileInfo(
                    name=metadata.name,
                    path=metadata.path_lower,
                    size=0,
                    modified="",
                    is_folder=True
                )
                
        except Exception as e:
            raise ValueError(f"Failed to get file info for {file_path}: {e}")
  • Pydantic BaseModel used as the return type for get_file_info, defining the schema for file information including name, path, size, modification time, folder status, and optional content preview.
    class FileInfo(BaseModel):
        """File information structure."""
        name: str
        path: str
        size: int
        modified: str
        is_folder: bool
        content_preview: Optional[str] = None
  • Duplicate handler function for the 'get_file_info' tool in dockerfile.py, identical to the one in dropbox_server.py.
    @mcp.tool()
    def get_file_info(file_path: str) -> FileInfo:
        """
        Get detailed information about a specific file.
        
        Args:
            file_path: Full path to the file in Dropbox
        """
        if not dropbox_client:
            initialize_dropbox_client()
        
        try:
            metadata = dropbox_client.files_get_metadata(file_path)
            
            if isinstance(metadata, dropbox.files.FileMetadata):
                return FileInfo(
                    name=metadata.name,
                    path=metadata.path_lower,
                    size=metadata.size,
                    modified=metadata.server_modified.isoformat(),
                    is_folder=False
                )
            else:
                return FileInfo(
                    name=metadata.name,
                    path=metadata.path_lower,
                    size=0,
                    modified="",
                    is_folder=True
                )
                
        except Exception as e:
            raise ValueError(f"Failed to get file info for {file_path}: {e}")

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/cindyloo/dropbox-mcp-server'

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