Skip to main content
Glama

attach_to_process

Attach to a running process by ID to enable dynamic instrumentation for runtime analysis, reverse engineering, and application interaction through Frida's capabilities.

Instructions

Attach to a process by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidYesThe ID of the process to attach to.
device_idNoOptional ID of the device where the process is running. Uses smart selection when omitted.

Implementation Reference

  • The @mcp.tool()-decorated function that implements attaching to a process by PID using Frida's device.attach(pid). Includes inline schema via Pydantic Field and handles device resolution and errors.
    @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)}

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