@mcp.tool()
def get_documentation(topic: str = "general") -> Dict[str, Any]:
"""
Get documentation and usage examples.
Args:
topic: Documentation topic (general, memory, hooking, scanning, examples)
Returns:
Documentation for the requested topic.
"""
docs = {
"tool": "frida-game-hacking-mcp",
"official_docs": "https://frida.re/docs/",
"topic": topic
}
if topic == "general":
docs["quick_start"] = """
CHEAT ENGINE-STYLE WORKFLOW:
1. Find your target process:
list_processes("game")
2. Attach to the process:
attach("game.exe")
3. Scan for a known value (e.g., health = 100):
scan_value(100, "int32")
4. Change the value in-game and narrow results:
scan_next(95)
5. Repeat until you find the address, then modify:
write_memory("0x12345678", "E7030000") # 999
PATTERN SCANNING (for code that survives updates):
scan_pattern("89 47 44 ?? ?? 5B", "r-x")
FUNCTION HOOKING:
hook_function("0x401234",
on_enter="console.log('Called!');",
on_leave="retval.replace(1);")
"""
docs["value_types"] = [
"int8/uint8 (1 byte)", "int16/uint16 (2 bytes)",
"int32/uint32 (4 bytes)", "int64/uint64 (8 bytes)",
"float (4 bytes)", "double (8 bytes)", "string"
]
elif topic == "scanning":
docs["workflow"] = """
MEMORY SCANNING WORKFLOW:
1. scan_value(100, "int32") - Initial scan
2. scan_next(95) - Narrow after value changes
3. scan_changed() - Find values that changed
4. scan_unchanged() - Find values that stayed same
5. get_scan_results() - View matching addresses
6. clear_scan() - Reset for new scan
PATTERN SCANNING:
scan_pattern("89 47 ?? 5B", "r-x")
- ?? = wildcard (matches any byte)
- "r-x" = code sections
- "rw-" = data sections
"""
elif topic == "hooking":
docs["examples"] = """
INTERCEPT FUNCTION:
hook_function("0x401234",
on_enter="console.log('Args:', args[0]);",
on_leave="console.log('Return:', retval);")
REPLACE RETURN VALUE:
replace_function("0x401234", 1) # Always return 1
HOOK BY NAME:
intercept_module_function("game.dll", "CheckLicense",
on_leave="retval.replace(1);")
EARLY HOOKING:
spawn("game.exe")
hook_function("0x401234", ...)
resume()
"""
return docs