Skip to main content
Glama
renef-mcp
by Ahmeth4n

renef_hook_native

Install native ARM64 hooks on library functions by offset or export symbol, with Lua on-enter/on-leave callbacks, PLT/GOT targeting, async observation, and deferred loading.

Instructions

Install a native ARM64 hook on a library function by hex offset or export symbol name.

Supports all Renef v0.4.0 native hook features:

  • Inline trampoline hooks (default) or PLT/GOT targeted hooks (caller="libfoo.so" or "*")

  • Custom Lua on_enter (args[0..7] = x0-x7) and on_leave (retval = x0; return value overrides x0)

  • Default argument/return logging when both on_enter and on_leave are omitted

  • Fire-and-forget async hooks (asynchronous=True) for high-frequency observation-only hooks

  • Deferred hooks: if lib_name is not loaded yet (e.g., under renef_spawn(..., pause=True)), the hook is automatically installed the instant the library loads!

Args: lib_name: Library name (e.g., "libc.so", "libnative.so") target: Hex offset (e.g., "0x1234") or export symbol name (e.g., "open", "SSL_read") on_enter: Optional Lua body for onEnter (args table in scope; e.g., 'print(Memory.readStr(args[0]))') on_leave: Optional Lua body for onLeave (retval in scope; e.g., 'return 0') caller: Optional caller library for PLT/GOT hooking (e.g., "libapp.so" or "*") asynchronous: If True, runs onEnter off the hot path (observation-only, no onLeave)

Returns: JSON status with hook ID (or deferred flag) and details

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "lib_name": "<lib_name>",
      "target": "<target>"
    },
    "name": "renef_hook_native"
  }
}

Input Schema

NameRequiredDescriptionDefault
callerNo
targetYes
lib_nameYes
on_enterNo
on_leaveNo
asynchronousNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden and does substantial work: it discloses async semantics (runs off the hot path, no `on_leave`), automatic deferred installation when the library is not yet loaded, default argument/return logging when both callbacks are omitted, and that a returned value overrides x0. Gaps remain around preconditions (root/permissions), failure behavior for an invalid offset, and hook lifetime, but the behavioral surface is far richer than typical.

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

Conciseness4/5

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

The opening sentence front-loads the action and targeting options, and the bullet list is scannable. There is some duplication between the feature bullets and the Args block (on_enter/on_leave semantics appear twice), which costs a little, but no sentence is wholly wasted.

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

Completeness4/5

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

For a six-parameter, no-annotation, high-complexity hooking tool, this covers targeting, callback contract, async mode, deferred install, and default logging, and an output schema exists so return values need not be spelled out. What is missing is operational preconditions—required privileges, behavior on bad offsets, and how the resulting hook is later removed.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must compensate entirely, and it does: every one of the six parameters is explained with concrete syntax and examples, including offset vs. export-symbol forms for `target`, the `args[0..7]`/x0-x7 mapping for `on_enter`, `retval` scope for `on_leave`, wildcard `"*"` for `caller`, and the exclusion of `on_leave` under async mode.

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

Purpose4/5

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

States a specific verb and resource: 'Install a native ARM64 hook on a library function by hex offset or export symbol name.' The native/ARM64 framing distinguishes it from a Java-hook sibling, but no sibling is named explicitly, so routing relies on the agent inferring from the name and platform qualifier.

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

Usage Guidelines3/5

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

It gives situational guidance for individual modes—use `caller` for PLT/GOT hooking, `asynchronous=True` for high-frequency observation-only hooks, and rely on deferred install under `renef_spawn(..., pause=True)`—but never states when to choose this tool over `renef_hook_generate` or `renef_interceptor`, nor any case where it should not be used.

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