clear_hook_messages
Clear the hook message buffer without retrieving messages, preventing buffer overflow and enabling continuous Frida instrumentation during Android security testing.
Instructions
Clear the hook message buffer without retrieving
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/frida_mcp/hooks.py:125-129 (handler)The core handler function for clear_hook_messages. Gets the active FridaSession and calls fs.clear_messages() to clear the hook message buffer, returning the count of cleared messages and session_id.
def clear_hook_messages() -> dict: """Clear the hook message buffer.""" fs = get_session() count = fs.clear_messages() return {"cleared": count, "session_id": fs.id} - src/frida_mcp/tools.py:290-294 (registration)Tool registration definition. Declares the 'clear_hook_messages' tool with an empty inputSchema (no arguments needed) and a description: 'Clear the hook message buffer without retrieving'.
Tool( name="clear_hook_messages", description="Clear the hook message buffer without retrieving", inputSchema={"type": "object", "properties": {}, "required": []}, ), - src/frida_mcp/server.py:116-117 (registration)Dispatch routing in call_tool function. Maps the string 'clear_hook_messages' to hooks.clear_hook_messages() when the tool is called by name.
elif name == "clear_hook_messages": return hooks.clear_hook_messages() - src/frida_mcp/session.py:66-71 (helper)The FridaSession.clear_messages() method called by the handler. Thread-safe clearing of the hook_messages list, returns the count of messages cleared.
def clear_messages(self) -> int: """Thread-safe message clearing.""" with self._lock: count = len(self.hook_messages) self.hook_messages = [] return count