read_registers
Retrieve CPU register values for game debugging and reverse engineering. This tool provides thread and architecture information to analyze program execution states.
Instructions
Read CPU register values.
Note: Full register context available in hook callbacks via 'this.context'.
Returns:
Basic thread and architecture info.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main handler function for the 'read_registers' tool. It injects a Frida script to retrieve basic process architecture, platform, pointer size, and current thread ID. Notes that full register access is available within hook callbacks using 'this.context'.@mcp.tool() def read_registers() -> Dict[str, Any]: """ Read CPU register values. Note: Full register context available in hook callbacks via 'this.context'. Returns: Basic thread and architecture info. """ global _session if not _session.is_attached(): return {"error": "Not attached. Use attach() first."} try: script_code = """ send(JSON.stringify({ arch: Process.arch, platform: Process.platform, pointer_size: Process.pointerSize, thread_id: Process.getCurrentThreadId() })); """ result_data = [] def on_message(message, data): if message['type'] == 'send': result_data.append(message['payload']) script = _session.session.create_script(script_code) script.on('message', on_message) script.load() script.unload() import json result = json.loads(result_data[0]) if result_data else {} result["note"] = "Full registers available in hook via 'this.context'" return result except Exception as e: return {"error": f"Failed to read registers: {str(e)}"}