android-file
Manage files and directories on Android devices using a versatile tool. Perform actions like listing, uploading, downloading, deleting, creating, checking existence, reading, writing, and retrieving file statistics. Specify device paths and operations via parameters for streamlined file management.
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.
- Requires:
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.
- Requires:
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.
- Requires:
action="delete_file"
: Deletes a file or directory from the device.- Requires:
path
(path to delete on device). - Returns: String message confirming deletion.
- Requires:
action="create_directory"
: Creates a directory on the device.- Requires:
path
(directory path to create on device). - Returns: String message confirming creation.
- Requires:
action="file_exists"
: Checks if a file or directory exists on the device.- Requires:
path
(path to check on device). - Returns:
True
if exists,False
otherwise.
- Requires:
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.
- Requires:
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.
- Requires:
action="file_stats"
: Gets detailed statistics for a file or directory.- Requires:
path
(path on device). - Returns: Markdown-formatted string of file/directory statistics.
- Requires:
Input Schema
Name | Required | Description | Default |
---|---|---|---|
action | Yes | ||
content | No | ||
device_path | No | ||
local_path | No | ||
max_size | No | ||
path | No | ||
serial | Yes |