example_queries.md•7.04 kB
# Chapter 9: Example AI Assistant Queries & Workflows
This chapter brings together everything we've learned by showcasing practical examples of how you can interact with DroidMind through your AI assistant. These scenarios demonstrate how to combine different DroidMind tools and capabilities to solve common Android development, debugging, and management tasks.
Remember to replace placeholders like `your_device_serial`, `com.example.myapp`, and file paths with your actual details.
## 9.1 Basic Device Checkup
**Goal**: Get a quick overview of a connected device.
**Example Conversation with AI:**
> **You**: "Hey AI, I just connected a new test device. Can you give me a quick checkup on `your_device_serial`?"
> **AI (using DroidMind `list_devices` and `device_properties`):**
> "Okay, `your_device_serial` (model: Pixel 6, Android Version: 13) is connected.
> Key properties:
>
> - **Model**: Pixel 6
> - **Brand**: google
> - **Android Version**: 13
> - **SDK Level**: 32
> - **Build Number**: TP1A.220624.014
> Is there anything specific you'd like to know or do with it?"
## 9.2 Debugging an Application Crash
**Goal**: Investigate why an application is crashing.
**Example Conversation with AI:**
> **You**: "My app `com.example.myapp` just crashed on `emulator-5554`. Can you help me figure out why?"
> **AI (using DroidMind `app_logs`, `device_crash_logs`):**
> "I'm sorry to hear that! Let me check the logs for `com.example.myapp` on `emulator-5554` and any general crash reports...
>
> (After DroidMind provides data)
>
> Okay, I found the following in the app logs for `com.example.myapp` around the time of the crash:
>
> ```log
> 01-15 14:10:05.123 E AndroidRuntime: FATAL EXCEPTION: main
> 01-15 14:10:05.123 E AndroidRuntime: Process: com.example.myapp, PID: 12345
> 01-15 14:10:05.123 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.example.myapp.SomeObject.doSomething()' on a null object reference
> 01-15 14:10:05.123 E AndroidRuntime: at com.example.myapp.MyActivity.onCreate(MyActivity.java:42)
> ...
> ```
>
> It looks like a NullPointerException occurred in `MyActivity.java` at line 42. You might be trying to use an object `SomeObject` that hasn't been initialized. Would you like me to check the device's ANR traces as well?"
## 9.3 Transferring Files and Verifying
**Goal**: Upload a configuration file to the device, then verify its contents.
**Example Conversation with AI:**
> **You**: "Please upload `/Users/bliss/Desktop/new_config.xml` to `/sdcard/AppConfig/` on `your_device_serial`."
> **AI (using DroidMind `push_file`):**
> "Done! The file `new_config.xml` has been uploaded to `/sdcard/AppConfig/` on `your_device_serial`."
> **You**: "Thanks! Now, can you read back the contents of `/sdcard/AppConfig/new_config.xml` on that device?"
> **AI (using DroidMind `read_file`):**
> "Certainly! Here are the contents of `/sdcard/AppConfig/new_config.xml`:
>
> ````xml
> <config>
> <setting name="feature_alpha" enabled="true" />
> <timeout value="5000" />
> </config>
> ```"
> ````
## 9.4 Cleaning Up an Application for Testing
**Goal**: Stop an app, clear its data, and then restart it for a fresh test run.
**Example Conversation with AI:**
> **You**: "I need to re-test the onboarding flow for `com.example.testapp` on `emulator-5554`. Can you prepare the app for a fresh start?"
> **AI (using DroidMind `stop_app`, `clear_app_data`, then `start_app`):**
> "Okay, I will perform the following steps on `emulator-5554` for `com.example.testapp`:
>
> 1. Force stop the application.
> 2. Clear its data and cache.
> 3. Start the application again.
>
> (After DroidMind operations complete)
>
> All done! `com.example.testapp` has been stopped, its data cleared, and it has been restarted. It should be in a fresh state now."
## 9.5 Basic UI Interaction
**Goal**: Navigate to a specific screen in an app using UI automation tools.
> **You**: "On `emulator-5554`, I need to open the Settings app and then tap on the 'Network & internet' option. I'll need a screenshot first to see where it is."
> **AI (using DroidMind `start_app`, then `screenshot`):**
> "Okay, I'll start the Settings app (`com.android.settings`) on `emulator-5554`. One moment...
> Here's a screenshot of the main Settings screen:
>
> [AI displays screenshot]
>
> Based on the screenshot, it looks like 'Network & internet' is near the top. Could you give me the approximate coordinates if you see it, or I can try to find it based on text if a future DroidMind version supports that."
> **You**: "Okay, from the screenshot, it looks like it's around X 300, Y 500. Please tap there."
> **AI (using DroidMind `tap`):**
> "Tapping at (300, 500) on `emulator-5554`... Done! Let me know if that opened the correct screen."
## 9.6 Checking Device Resources before an Update
**Goal**: Ensure a device has enough space and a good battery level before attempting a large app update.
**Example Conversation with AI:**
> **You**: "I'm about to push a large update for `com.mycorp.bigapp` to `your_device_serial`. Can you check its available storage and current battery level?"
> **AI (using DroidMind `shell_command` for `df -h`, and `device_battery_stats`):**
> "Let me check those for you on `your_device_serial`...
>
> (After DroidMind provides data)
>
> - **Storage**: The `/data` partition has 2.5GB free.
> - **Battery**: Currently at 85% and charging.
>
> It looks like you have sufficient storage and a good battery level for the update."
## 9.7 Investigating a Slow App
**Goal**: Get initial diagnostics for an app that feels sluggish.
> **You**: "The app `com.example.slowapp` on `emulator-5554` has been very slow lately. Can you get me some initial diagnostics? Perhaps its logs and a summary of its manifest?"
> **AI (using DroidMind `app_logs`, `get_app_manifest`):**
> "I can help with that. I'll fetch the recent logs for `com.example.slowapp` and its manifest details from `emulator-5554`...
>
> (After DroidMind provides data)
>
> Here's a summary:
>
> - **Logs**: I see several 'Choreographer: Skipped X frames!' messages, which often indicate UI jank. There are also some network timeout errors.
> - **Manifest**: The app requests permissions for `INTERNET`, `ACCESS_FINE_LOCATION`, and `READ_EXTERNAL_STORAGE`. It has 3 activities, 2 services, and 1 broadcast receiver defined.
>
> Based on this, the slowness might be related to UI performance issues or network problems. Would you like to dump the heap for this app or get a full bug report for more detailed analysis?"
These examples are just a starting point. The power of DroidMind lies in its flexibility, allowing your AI assistant to combine these tools in numerous ways to address your specific needs. Don't hesitate to experiment with complex requests and multi-step workflows!
---
This concludes the DroidMind User Manual. For a detailed list of all tools and their parameters, please refer to the **[MCP Reference](mcp-reference.md)**.
Happy DroidMinding! 🤖✨