Skip to main content
Glama

renef_hook_java

Install a Java method hook for Android instrumentation using JNI class names and signatures. Intercept method calls and modify arguments or return values through on_enter and on_leave callbacks.

Instructions

Install a Java method hook. class_name in JNI slash format (e.g. "com/example/Class"), signature in JNI format (e.g. "(Ljava/lang/String;)Z"). arg layout: args[0]=ArtMethod* (ignore), args[1]=this (instance methods), args[2..]=parameters. Use on_enter="args.skip = true" to bypass void methods. Wrap uncertain classes in pcall via renef_exec.

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": {
      "class_name": "<class_name>",
      "method": "<method>",
      "signature": "<signature>"
    },
    "name": "renef_hook_java"
  }
}

Input Schema

NameRequiredDescriptionDefault
methodYes
on_enterNo
on_leaveNo
signatureYes
class_nameYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose the callback argument layout (args[0]=ArtMethod*, args[1]=this, args[2..]=parameters), which is genuinely behavioral. It says nothing about hook lifetime, how to remove a hook, failure modes, or whether the hook is process-wide or class-wide, all important for an instrumentation tool that mutates runtime behavior.

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 definition is front-loaded with the action, then immediately gives format requirements and the argument-layout convention. Every sentence carries technical content an agent needs; there is no filler or restatement of the name.

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?

An output schema exists, so return values need not be described. But for a hook-installation tool with no annotations and five parameters, the description omits on_leave semantics, how to undo the hook, and any error/failure behavior beyond the pcall workaround, leaving gaps an agent will hit on non-trivial use.

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

Parameters4/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, and it largely does: JNI slash format for class_name with an example, JNI signature format with an example, and the semantics of on_enter via the args.skip pattern. It leaves on_leave unexplained and never states that `method` is the bare method name, so coverage is good but not complete.

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?

The first sentence gives a specific verb and resource: "Install a Java method hook." The word "Java" implicitly separates it from renef_hook_native and renef_hook_generate, but the description never states that distinction explicitly, so an agent must infer it from names.

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

Usage Guidelines4/5

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

It gives concrete tactical guidance: use on_enter="args.skip = true" to bypass void methods, and wrap uncertain classes in pcall via renef_exec. That names a real sibling and the condition that selects it. It does not explain when to prefer this over renef_hook_native or renef_hook_generate, which is the main selection decision an agent faces.

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