Skip to main content
Glama

enumerate_processes

Lists all running processes on a system with their IDs and names to enable process management and analysis for mobile and desktop applications.

Instructions

List all processes running on the system.

Returns:
    A list of process information dictionaries containing:
    - pid: Process ID
    - name: Process name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_idNoOptional ID of the device to enumerate processes from. Uses smart selection when omitted.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the MCP tool 'enumerate_processes'. Decorated with @mcp.tool(), it resolves a Frida device using _resolve_device_or_raise, enumerates processes via Frida's device.enumerate_processes(), and returns a list of dictionaries with pid and name.
    @mcp.tool()
    def enumerate_processes(
        device_id: Optional[str] = Field(
            default=None,
            description="Optional ID of the device to enumerate processes from. Uses smart selection when omitted.",
        ),
    ) -> List[Dict[str, Any]]:
        """List all processes running on the system.
    
        Returns:
            A list of process information dictionaries containing:
            - pid: Process ID
            - name: Process name
        """
        device = _resolve_device_or_raise(device_id)
        processes = device.enumerate_processes()
        return [{"pid": process.pid, "name": process.name} for process in processes]
  • A related MCP resource that also uses device.enumerate_processes() to list processes as a string.
    @mcp.resource("frida://processes")
    def get_processes_resource() -> str:
        """Get a list of processes from the currently selected default device as a readable string."""
        device = _resolve_device_or_raise()
        processes = device.enumerate_processes()
        return "\n".join([f"PID: {p.pid}, Name: {p.name}" for p in processes])
  • Helper function used by the tool to resolve the Frida device, imported from device_selection.py but wrapped to raise ValueError.
                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
    
    
    @mcp.tool()
    def enumerate_processes(
        device_id: Optional[str] = Field(
            default=None,
            description="Optional ID of the device to enumerate processes from. Uses smart selection when omitted.",
        ),
    ) -> List[Dict[str, Any]]:
        """List all processes running on the system.
    
        Returns:
            A list of process information dictionaries containing:
            - pid: Process ID
            - name: Process name
        """
        device = _resolve_device_or_raise(device_id)
        processes = device.enumerate_processes()
        return [{"pid": process.pid, "name": process.name} for process in processes]
    
    
    @mcp.tool()
    def enumerate_devices() -> List[Dict[str, Any]]:
        """List all devices connected to the system.
    
        Returns:
            A list of device information dictionaries containing:
            - id: Device ID
            - name: Device name
            - type: Device type
            - hint: How to reference the device via device_id
            - alias: Configured alias for remote devices (if any)
            - default_candidate: Whether the device is the current default choice
        """
        return describe_devices()
    
    
    @mcp.tool()
    def configure_remote_device(
        address: str = Field(description="The remote <host>:<port> to add."),
        alias: Optional[str] = Field(
            default=None,
            description="Optional alias used as device_id when targeting this remote.",
        ),
        set_as_default: bool = Field(
            default=False,
            description="If true, future requests without device_id will prefer this remote.",
        ),
    ) -> Dict[str, Any]:
        """Connect to a remote Frida server and make it available for future requests."""
    
        try:
            info = register_remote_device(address, alias=alias, set_default=set_as_default)
        except DeviceSelectionError as exc:
            if exc.reasons:
                attempts = "; ".join(exc.reasons)
                raise ValueError(f"{exc}. Attempts: {attempts}") from exc
            raise ValueError(str(exc)) from exc
    
        response: Dict[str, Any] = {"status": "success"}
        response.update(info)
        if set_as_default:
            response["message"] = "Remote device set as default"
        return response
    
    
    @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,
        }
    
    
    @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")
    
    
    @mcp.tool()
    def get_local_device() -> Dict[str, Any]:
        """Get the local device.
    
        Returns:
            Information about the local device
        """
        try:
            device = frida.get_local_device()
            return {
                "id": device.id,
                "name": device.name,
                "type": device.type,
            }
        except frida.InvalidArgumentError:  # Or other relevant Frida exceptions
            raise ValueError("No local device found or error accessing it.")
    
    
    @mcp.tool()
    def get_process_by_name(
        name: str = Field(
            description="The name (or part of the name) of the process to find. Case-insensitive."
        ),
        device_id: Optional[str] = Field(
            default=None,
            description="Optional ID of the device to search the process on. Uses smart selection when omitted.",
        ),
    ) -> dict:
        """Find a process by name."""
        device = _resolve_device_or_raise(device_id)
        for proc in device.enumerate_processes():
            if name.lower() in proc.name.lower():
                return {"pid": proc.pid, "name": proc.name, "found": True}
        return {"found": False, "error": f"Process '{name}' not found"}
    
    
    @mcp.tool()
    def attach_to_process(
        pid: int = Field(description="The ID of the process to attach to."),
        device_id: Optional[str] = Field(
            default=None,
            description="Optional ID of the device where the process is running. Uses smart selection when omitted.",
        ),
    ) -> dict:
        """Attach to a process by ID."""
        try:
            device = _resolve_device_or_raise(device_id)
            device.attach(pid)
            return {
                "pid": pid,
                "success": True,
                "is_detached": False,  # New session is not detached
            }
        except Exception as e:
            return {"success": False, "error": str(e)}
    
    
    @mcp.tool()
    def spawn_process(
        program: str = Field(description="The program or application identifier to spawn."),
        args: Optional[List[str]] = Field(
            default=None, description="Optional list of arguments for the program."
        ),
        device_id: Optional[str] = Field(
            default=None,
            description="Optional ID of the device where the program should be spawned. Uses smart selection when omitted.",
        ),
    ) -> Dict[str, Any]:
        """Spawn a program.
    
        Returns:
            Information about the spawned process
        """
        try:
            device = _resolve_device_or_raise(device_id)
    
            argv = None
            if args:
                argv = list(args)
                if not argv or argv[0] != program:
                    argv.insert(0, program)
    
            pid = device.spawn(program, argv=argv)
    
            return {"pid": pid}
        except Exception as e:
            raise ValueError(f"Failed to spawn {program}: {str(e)}")
    
    
    @mcp.tool()
    def resume_process(
        pid: int = Field(description="The ID of the process to resume."),
        device_id: Optional[str] = Field(
            default=None,
            description="Optional ID of the device where the process is running. Uses smart selection when omitted.",
        ),
    ) -> Dict[str, Any]:
        """Resume a process by ID.
    
        Returns:
            Status information
        """
        try:
            device = _resolve_device_or_raise(device_id)
            device.resume(pid)
    
            return {"success": True, "pid": pid}
        except Exception as e:
            raise ValueError(f"Failed to resume process {pid}: {str(e)}")
    
    
    @mcp.tool()
    def kill_process(
        pid: int = Field(description="The ID of the process to kill."),
        device_id: Optional[str] = Field(
            default=None,
            description="Optional ID of the device where the process is running. Uses smart selection when omitted.",
        ),
    ) -> Dict[str, Any]:
        """Kill a process by ID.
    
        Returns:
            Status information
        """
        try:
            device = _resolve_device_or_raise(device_id)
            device.kill(pid)
    
            return {"success": True, "pid": pid}
        except Exception as e:
            raise ValueError(f"Failed to kill process {pid}: {str(e)}")
Behavior4/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool returns a list of process information with specific fields (pid, name), which is useful behavioral context. However, it doesn't mention potential side effects, permissions needed, or rate limits, leaving some gaps for a read operation.

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

Conciseness5/5

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

The description is front-loaded with the core purpose in the first sentence, followed by a clear return value specification. Every sentence adds value without redundancy, making it efficient and well-structured.

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

Completeness5/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 (one optional parameter), 100% schema coverage, and the presence of an output schema (implied by the return description), the description is complete enough. It explains what the tool does and what it returns, covering essential context without unnecessary detail.

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?

Schema description coverage is 100%, so the schema already documents the single optional parameter 'device_id' with its description. The description adds no additional parameter information beyond what the schema provides, meeting the baseline for high coverage.

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

Purpose5/5

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

The description clearly states the specific action ('List all processes') and resource ('processes running on the system'), distinguishing it from siblings like 'get_process_by_name' (which filters) and 'kill_process' (which modifies). It provides a complete picture of what the tool does.

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

Usage Guidelines3/5

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

The description implies usage for listing processes but doesn't explicitly state when to use this versus alternatives like 'get_process_by_name' (for filtering) or 'enumerate_devices' (for device listing). No exclusions or prerequisites are mentioned, leaving some ambiguity in context.

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