Skip to main content
Glama

get_device

Retrieve device information by ID from the Frida MCP server to manage and analyze mobile/desktop applications through dynamic instrumentation.

Instructions

Get a device by its ID.

Returns: Information about the device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_idYesThe ID of the device to get

Implementation Reference

  • The handler function for the MCP tool 'get_device'. It uses _resolve_device_or_raise to fetch the specified device and returns a dictionary with id, name, and type.
    @mcp.tool() def get_device( device_id: str = Field(description="The ID of the device to get"), ) -> Dict[str, Any]: """Get a device by its ID. Returns: Information about the device """ device = _resolve_device_or_raise(device_id) return { "id": device.id, "name": device.name, "type": device.type, }
  • Helper function used by get_device and other tools to resolve a device ID to a Frida device object, raising ValueError on failure.
    def _resolve_device_or_raise(device_id: Optional[str] = None) -> Any: """Resolve a Frida device using the smart selector and convert errors.""" try: logger.debug("Resolving device for id=%s", device_id or "<default>") device = resolve_device(device_id) logger.debug( "Resolved device id=%s -> %s (%s)", device_id or "<default>", getattr(device, "id", "<unknown>"), getattr(device, "type", "<unknown>"), ) return device except DeviceSelectionError as exc: if exc.reasons: attempts = "; ".join(exc.reasons) logger.error( "Device resolution failed for id=%s: %s (attempts: %s)", device_id or "<default>", exc, attempts, ) raise ValueError(f"{exc}. Attempts: {attempts}") from exc logger.error( "Device resolution failed for id=%s: %s", device_id or "<default>", exc, ) raise ValueError(str(exc)) from exc
  • Public helper that resolves device_id using the global DeviceSelector instance.
    def resolve_device(device_id: Optional[str] = None) -> Any: global _selector if _selector is None: _selector = DeviceSelector() try: return _selector.get_device(device_id) except DeviceSelectionError: # re-raise so callers can handle uniformly raise
  • Core logic in DeviceSelector class for getting a device by ID or auto-selecting based on config.
    def get_device(self, device_id: Optional[str] = None) -> Any: identifier = (device_id or "").strip() if identifier: return self._get_by_identifier(identifier) default_choice = (self._config.default_device or "").strip() if default_choice and default_choice.lower() not in {"auto", "smart"}: return self._get_by_identifier(default_choice) return self._auto_select()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rmorgans/frida-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server