load_script
Load custom JavaScript scripts into game processes for memory scanning, value modification, and function hooking using Frida's instrumentation framework.
Instructions
Load a custom Frida JavaScript script.
Args:
script_code: JavaScript code to load
name: Name to identify the script
Returns:
Load status.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script_code | Yes | ||
| name | No | custom |
Implementation Reference
- The handler function that implements the 'load_script' MCP tool. It creates and loads a Frida script into the current session, storing it by name for later use with unload_script or call_rpc.@mcp.tool() def load_script(script_code: str, name: str = "custom") -> Dict[str, Any]: """ Load a custom Frida JavaScript script. Args: script_code: JavaScript code to load name: Name to identify the script Returns: Load status. """ global _session if not _session.is_attached(): return {"error": "Not attached. Use attach() first."} if name in _session.custom_scripts: return {"error": f"Script '{name}' exists. Use unload_script() first."} try: script = _session.session.create_script(script_code) script.on('message', lambda m, d: logger.info(f"[{name}] {m}")) script.load() _session.custom_scripts[name] = script return {"success": True, "name": name} except Exception as e: return {"error": f"Failed to load script: {str(e)}"}