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
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes |
Implementation Reference
- dropbox_server.py:295-328 (handler)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}")
- dropbox_server.py:42-50 (schema)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
- dockerfile.py:295-328 (handler)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}")