Skip to main content
Glama
I-CAN-hack
by I-CAN-hack

namespaces

Organize and recover C++ namespaces and classes in stripped firmware: list existing ones, create new hierarchy levels, move symbols into them, and auto-type class methods with the this pointer.

Instructions

List, create, or populate C++ namespaces and classes.

Namespaces and classes are real Ghidra `Namespace`/`GhidraClass` objects,
not name prefixes. Use this to recover C++ structure in stripped firmware:
create a class per recovered vtable, then move its methods into it.

Actions:
- `list`: return the namespaces and classes in the program as JSON, each
  with its qualified name, `type` (`Namespace`/`Class`/...), and member
  count. Filter with `filter` (substring or glob over name/qualified name).
- `create`: create the namespace or class at `path` (a `::`-separated path
  such as `MyClass` or `ns::sub::Inner`). Missing parent levels are created
  as plain namespaces. `kind="class"` makes the final level a `GhidraClass`
  (an existing plain namespace at that path is converted to a class);
  `kind="namespace"` makes it a plain namespace. Existing entries are
  reused, so this is idempotent.
- `move`: move the symbol at `target` (address, label, or function name)
  into `namespace` (created if missing, honoring `kind`). Functions are
  reparented; other symbols are moved with their name preserved.
- `type_methods`: for the class at `path`, set the first parameter of every
  function member to `<class> *this` (adding one if a method has none) so
  the decompiler propagates the class type. The class is created if missing.
  Methods already typed with the class pointer are left as-is. Reports
  `typed_methods` and `already_typed`. Use this to type a whole class at
  once instead of calling `set_prototype` per method.

Args:
    program: Required Ghidra project path or name to target.
    action: One of `list`, `create`, `move`, or `type_methods`.
    path: Namespace/class path for `create`/`type_methods`, e.g. `MyClass`
        or `a::b::C`.
    target: Symbol selector for `move` (address, label, or function name).
    namespace: Destination namespace/class path for `move`.
    kind: `namespace` or `class`; the kind of the final level that
        `create`/`move` resolves or creates.
    filter: Substring/glob filter for `list`. `*` returns everything.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kindNonamespace
pathNo
actionNolist
filterNo*
targetNo
programYes
namespaceNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations provided, the description carries the full behavioral disclosure burden. It explains side effects such as missing parent levels being created, existing entries being reused idempotently, namespaces being converted to classes, move behavior for functions versus other symbols, and the exact type_methods transformation including already-typed functions being left as-is.

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 long but appropriately so for a multi-action tool with seven parameters and no schema-level descriptions. It is front-loaded with the purpose and use case, followed by clear per-action details and an Args section. Every section adds necessary information without filler.

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

Completeness5/5

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

Given the tool's complexity, the absence of annotations, and 0% schema description coverage, the description provides enough detail for an agent to select the right action and invoke it correctly. The output schema covers return values, so the description does not need to repeat them.

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 explain every parameter. The Args section covers all seven parameters, including allowed action values, path syntax with examples, namespace kind semantics, and filter behavior. This goes well beyond the bare schema titles.

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 opens with 'List, create, or populate C++ namespaces and classes', giving a specific verb and resource. It further disambiguates by noting these are real Ghidra objects, not name prefixes, and enumerates the four actions, making the tool's scope clear relative to siblings like labels or get_types.

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?

The description gives an explicit use case: 'Use this to recover C++ structure in stripped firmware: create a class per recovered vtable, then move its methods into it.' It also explicitly contrasts type_methods with calling set_prototype per method. It does not exhaustively explain when not to use the tool versus every sibling, but the provided guidance is clear.

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