android-file
Perform file operations on Android devices: list directories, push/pull files, delete, create folders, check existence, read and write file content, and view file statistics using a single command.
Instructions
Perform file and directory operations on an Android device.
This single tool consolidates various file system actions. The 'action' parameter determines the operation.
Args: serial: Device serial number. action: The specific file operation to perform. See available actions below. ctx: MCP Context for logging and interaction. path (Optional[str]): General path argument on the device. Used by: list_directory, delete_file, create_directory, file_exists, file_stats. Can also be used by read_file and write_file as an alternative to 'device_path'. local_path (Optional[str]): Path on the DroidMind server machine. Used by: push_file (source), pull_file (destination). device_path (Optional[str]): Path on the Android device. Used by: push_file (destination), pull_file (source), read_file (source), write_file (destination). If 'path' is also provided for read/write, 'device_path' takes precedence. content (Optional[str]): Text content to write. Used by: write_file. max_size (Optional[int]): Maximum file size in bytes for read_file (default: 100KB). Used by: read_file.
Returns: Union[str, bool]: A string message indicating the result or status for most actions. Returns a boolean for the 'file_exists' action.
Available Actions and their specific argument usage:
action="list_directory": Lists contents of a directory.Requires:
path(directory path on device).Returns: Formatted string of directory contents.
action="push_file": Uploads a file from the local server to the device.Requires:
local_path(source on server),device_path(destination on device).Returns: String message confirming upload.
action="pull_file": Downloads a file from the device to the local server.Requires:
device_path(source on device),local_path(destination on server).Returns: String message confirming download.
action="delete_file": Deletes a file or directory from the device.Requires:
path(path to delete on device).Returns: String message confirming deletion.
action="create_directory": Creates a directory on the device.Requires:
path(directory path to create on device).Returns: String message confirming creation.
action="file_exists": Checks if a file or directory exists on the device.Requires:
path(path to check on device).Returns:
Trueif exists,Falseotherwise.
action="read_file": Reads the contents of a file from the device.Requires:
device_path(orpath) for the file on device.Optional:
max_size(defaults to 100KB).Returns: String containing file contents or error message.
action="write_file": Writes text content to a file on the device.Requires:
device_path(orpath) for the file on device,content(text to write).Returns: String message confirming write.
action="file_stats": Gets detailed statistics for a file or directory.Requires:
path(path on device).Returns: Markdown-formatted string of file/directory statistics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| serial | Yes | ||
| action | Yes | ||
| path | No | ||
| local_path | No | ||
| device_path | No | ||
| content | No | ||
| max_size | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |