Skip to main content
Glama

class_layout

Idempotent

Use method behavior to infer C++ class fields, methods, vftable slots, offsets, and widths; preview or apply the recovered layout as a named struct.

Instructions

Infer a C++ class's fields, methods and vftable from how its methods use the object: offset, width, reads, writes; unnamed slots hint names their vtable family agrees on. For a known layout use set_type. apply=Name saves it as a struct (dry run until dry_run=false).

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": "<class>"
    },
    "name": "class_layout"
  }
}

Input Schema

NameRequiredDescriptionDefault
applyNoStruct name to define the layout as.
classYesClass name or a method address.
dry_runNoPreview only; false applies.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false, idempotentHint=true and destructiveHint=false, so the description is not carrying the full safety burden. It nonetheless adds real value by disclosing the side effect (apply=Name saves a struct) and the safe-by-default behavior (dry run until dry_run=false), which the annotations alone don't convey. It stops short of describing what the inferred layout report looks like.

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?

Purpose is front-loaded, followed by the alternative and then the apply mechanics, with no filler sentences. The middle clause ('offset, width, reads, writes; unnamed slots hint names their vtable family agrees on') is dense abbreviated shorthand that costs some readability, keeping it below a 5.

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?

No output schema exists, yet the description characterizes the result (inferred fields, methods, vftable) and the save behavior clearly enough to call correctly. The only gap is that the exact shape of the returned layout isn't described, which is minor for a 3-parameter analysis tool.

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 coverage is 100%, so the baseline is 3; the description goes beyond it by explaining the relationship between apply (names the saved struct) and dry_run (false applies), rather than leaving each parameter isolated. That added semantics about how the parameters combine justifies a step above baseline.

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?

States a specific verb and resource ('Infer a C++ class's fields, methods and vftable from how its methods use the object') and adds concrete inference signals (offset, width, reads, writes; unnamed slots). It also distinguishes itself from the sibling set_type ('For a known layout use set_type'), so an agent can tell the tools apart without opening either schema.

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?

Provides an explicit routing rule to an alternative: use set_type when the layout is known, use this tool to infer an unknown one. It also explains the apply/dry_run interaction. What's missing is guidance on when a class must be loaded/analyzed first or failure modes, but the core when-to-use vs. alternative is present.

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