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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool returns 'Information about the device', which is vague and doesn't cover aspects like required permissions, error handling, or data format. This leaves significant gaps in understanding how the tool behaves beyond its basic function.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is brief and front-loaded with the core action, using two sentences efficiently. However, the second sentence ('Returns: Information about the device') is redundant given the presence of an output schema, slightly reducing its conciseness by not earning its place fully.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (single parameter, no nested objects) and the presence of an output schema, the description is minimally adequate. However, it lacks details on behavioral aspects like authentication or error cases, which are important for a tool with no annotations, making it incomplete for full contextual understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, fully documenting the 'device_id' parameter. The description adds no additional meaning beyond the schema, such as format examples or constraints, so it meets the baseline of 3 where the schema does the heavy lifting without extra value from the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('a device by its ID'), making the purpose specific and understandable. However, it doesn't differentiate from sibling tools like 'get_local_device' or 'get_usb_device', which might retrieve devices through different criteria, so it lacks explicit sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives such as 'enumerate_devices' for listing devices or 'get_local_device' for local device retrieval. It only states what the tool does without context or exclusions, leaving usage unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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