Skip to main content
Glama
cbxss
by cbxss

dump_class

Dump all methods, fields, and constructors of a Java class in Android applications for security analysis and reverse engineering.

Instructions

Dump all methods, fields, and constructors of a Java class

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
class_nameYesFull Java class name

Implementation Reference

  • Actual Frida agent RPC implementation that uses Java.use() and reflection to dump all methods, fields, and constructors of a Java class via the frida-java-bridge.
    dumpClass(className) {
        if (!Java.available) {
            throw new Error("Java runtime not available");
        }
        const result = { methods: [], fields: [], constructors: [] };
        Java.performNow(() => {
            try {
                const clazz = Java.use(className);
                const jClass = clazz.class;
    
                // Methods
                const methods = jClass.getDeclaredMethods();
                for (let i = 0; i < methods.length; i++) {
                    result.methods.push(methods[i].toString());
                }
    
                // Fields
                const fields = jClass.getDeclaredFields();
                for (let i = 0; i < fields.length; i++) {
                    result.fields.push(fields[i].toString());
                }
    
                // Constructors
                const ctors = jClass.getDeclaredConstructors();
                for (let i = 0; i < ctors.length; i++) {
                    result.constructors.push(ctors[i].toString());
                }
            } catch (e) {
                result.error = e.message;
            }
        });
        return result;
    },
  • Python server-side handler that gets the active Frida RPC API and calls dump_class on the agent with a 10-second timeout.
    def dump_class(class_name: str) -> dict:
        """Dump all methods and fields of a Java class."""
        api = get_api()
        return with_timeout(lambda: api.dump_class(class_name), timeout=10)
  • MCP tool registration defining the tool name, description, and input schema requiring a class_name string.
    Tool(
        name="dump_class",
        description="Dump all methods, fields, and constructors of a Java class",
        inputSchema={
            "type": "object",
            "properties": {
                "class_name": {"type": "string", "description": "Full Java class name"},
            },
            "required": ["class_name"],
        },
    ),
  • Dispatcher that routes the 'dump_class' tool call to the android.dump_class handler, passing the class_name argument.
    elif name == "dump_class":
        return android.dump_class(arguments["class_name"])
  • Helper that retrieves the active Frida session's RPC API, which android.dump_class uses to call the agent's dumpClass.
    def get_api():
        """Get the current Frida RPC API or raise error."""
        fs = registry.get_active()
        if fs is None:
            raise RuntimeError("Not connected. Use 'connect' tool first.")
        if not fs.is_alive():
            registry.remove(fs.id)
            raise RuntimeError("Session disconnected unexpectedly. Use 'connect' to reconnect.")
        return fs.api
Behavior2/5

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

With no annotations provided, the description carries full burden. It only says 'dump,' implying a read operation but lacks details on side effects, permissions required, or output behavior. The agent cannot infer safety or constraints.

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 of 8 words, front-loaded with the verb, and contains no wasted information. It is maximally concise.

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 simplicity (one parameter, no output schema, no annotations), the description states the purpose and the parameter. However, it does not describe the return format or any behavioral nuances, making it only minimally complete.

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% and the parameter description 'Full Java class name' is clear. The tool description adds no extra meaning beyond what the schema already provides, so baseline 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 tool dumps all methods, fields, and constructors of a Java class. It uses a specific verb ('dump') and resource, and distinguishes from siblings like android_list_methods by explicitly including fields and constructors.

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?

No guidance on when to use this tool versus alternatives such as android_list_methods. The description does not specify scenarios or prerequisites, leaving the agent without explicit usage context.

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