Skip to main content
Glama
cbxss
by cbxss

get_hook_messages

Retrieve messages from persistent hooks installed with install_hook. Optionally clear messages after retrieval to manage hook output effectively.

Instructions

Get collected messages from persistent hooks installed via install_hook

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clearNoClear messages after retrieving (default: false)

Implementation Reference

  • Main handler for get_hook_messages tool. Gets collected messages from persistent hooks via FridaSession.get_messages(), optionally clearing the buffer.
    def get_hook_messages(clear: bool = False) -> dict:
        """Get collected messages from persistent hooks."""
        fs = get_session()
        messages = fs.get_messages(clear=clear)
        return {
            "count": len(messages),
            "session_id": fs.id,
            "messages": messages
        }
  • Helper method on FridaSession that returns the last 50 hook messages, optionally clearing them, with thread-safe locking.
    def get_messages(self, clear: bool = False) -> list:
        """Thread-safe message retrieval."""
        with self._lock:
            messages = list(self.hook_messages[-50:])
            if clear:
                self.hook_messages = []
            return messages
  • Tool registration schema defining the get_hook_messages tool with an optional 'clear' boolean parameter.
    Tool(
        name="get_hook_messages",
        description="Get collected messages from persistent hooks installed via install_hook",
        inputSchema={
            "type": "object",
            "properties": {
                "clear": {"type": "boolean", "description": "Clear messages after retrieving (default: false)"},
            },
            "required": [],
        },
    ),
  • Helper method on FridaSession that adds messages to the buffer with size/limit constraints, called by persistent hook scripts.
    def add_message(self, hook_name: str, payload: Any, is_error: bool = False):
        """Thread-safe message addition with size limits."""
        with self._lock:
            if is_error:
                self.hook_messages.append({
                    "hook": hook_name,
                    "error": payload,
                    "ts": time_module.time()
                })
            else:
                if isinstance(payload, str) and len(payload) > 10000:
                    payload = payload[:10000] + "...[truncated]"
                self.hook_messages.append({
                    "hook": hook_name,
                    "payload": payload,
                    "ts": time_module.time()
                })
            if len(self.hook_messages) > 100:
                self.hook_messages = self.hook_messages[-100:]
  • Dispatcher in call_tool that routes 'get_hook_messages' requests to hooks.get_hook_messages().
    elif name == "get_hook_messages":
        return hooks.get_hook_messages(arguments.get("clear", False))
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must convey behavioral traits. It mentions 'persistent hooks' but does not disclose side effects (e.g., whether messages are consumed by default), permissions needed, or what happens when no messages exist. The 'clear' parameter behavior is not explained in the description, leaving gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no extraneous words. It is front-loaded and efficiently conveys the core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the low complexity (1 optional parameter, no output schema), the description is somewhat complete but lacks details on the return format or behavior when no messages are present. Since there is no output schema, the description should clarify what the agent can expect to receive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% as the single parameter 'clear' is fully described in the input schema. The description adds no additional meaning beyond the schema, so the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'collected messages from persistent hooks installed via install_hook'. It distinguishes this tool from siblings like 'clear_hook_messages' and 'install_hook', making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, nor does it mention prerequisites or scenarios where it should not be used. The sibling list includes 'clear_hook_messages' which is directly related, yet no comparison is made.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/cbxss/frida-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server