get_usb_device
Retrieve information about USB devices connected to the system for mobile and desktop application analysis using Frida's dynamic instrumentation capabilities.
Instructions
Get the USB device connected to the system.
Returns:
Information about the USB device
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/frida_mcp/cli.py:287-302 (handler)The primary handler for the MCP tool 'get_usb_device'. It retrieves the USB-connected Frida device using frida.get_usb_device(), formats its id, name, and type into a dictionary, and raises a ValueError if no USB device is found. The @mcp.tool() decorator registers this function as an MCP tool.@mcp.tool() def get_usb_device() -> Dict[str, Any]: """Get the USB device connected to the system. Returns: Information about the USB device """ try: device = frida.get_usb_device() return { "id": device.id, "name": device.name, "type": device.type, } except frida.InvalidArgumentError: raise ValueError("No USB device found")
- A private helper method in the DeviceSelector class that wraps the frida.get_usb_device() call, raising a custom DeviceSelectionError if no USB device is available. Used internally for device resolution when 'usb' is specified.def _get_usb_device(self) -> Any: try: return self._frida.get_usb_device() except self._frida.InvalidArgumentError as exc: # type: ignore[attr-defined] raise DeviceSelectionError("No USB devices detected") from exc
- src/frida_mcp/cli.py:287-287 (registration)The @mcp.tool() decorator on the get_usb_device function, which registers it as an MCP tool named 'get_usb_device'.@mcp.tool()