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

set_types

Define or update struct and enum types in Ghidra by providing C header declarations, with support for comments, padding, and references to existing types.

Instructions

Create or update one or more struct/enum types from C header text.

The input accepts normal C header style declarations, including `typedef
struct`, `typedef enum`, plain `struct`, and plain `enum` definitions.
Enum sizes can be set with comment directives such as
`/* ghidra-mcp enum-size: Name=1 */`.
Field comments are accepted from trailing `// ...` or `/* ... */`
comments and are applied to the resulting struct members.
To intentionally leave unknown bytes in a struct, add explicit placeholder
fields using Ghidra's undefined types, for example:
`undefined1 _pad[3];`, `undefined2 _pad;`, `undefined4 _reserved;`.
Use that for deliberate gaps; omitted fields only produce whatever natural
ABI padding the parsed C layout would normally create.
Missing referenced types are resolved from the current program's datatype
manager when possible, so new definitions can refer to already-existing
program types without re-declaring them inline.
Imported structs are stored as explicit-layout, non-packed Ghidra structs
so their size and padding remain directly editable after import.

The return value is the stored type definitions exported back out of Ghidra
as C header text.

Args:
    types: One or more type declarations in C header syntax.
    program: Required Ghidra project path or name to target.
    timeout: Timeout in seconds for the bridge-side parse/import/export.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typesYes
programYes
timeoutNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries full behavioral burden. It discloses how imported structs are stored (explicit-layout, non-packed), how missing types are resolved, how padding is handled, how to add deliberate gaps, and the return value format. This goes far beyond a simple 'create/update' statement.

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 description is front-loaded with the purpose and then provides detailed but relevant information on syntax, padding, resolution, and return value. It is somewhat lengthy but every sentence adds value; could be tightened slightly without losing clarity.

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 (parsing C headers, importing types, handling padding) and no annotations, the description is complete. It covers input format, behavioral nuances, return value, and parameter details, leaving no ambiguity for an agent to call it correctly.

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 coverage is 0%, so the description must compensate, and it does. It explains each parameter: types (C header syntax), program (required Ghidra path/name), and timeout (seconds). This adds meaning beyond the schema's bare type definitions.

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 states a specific action (create/update) on a specific resource (struct/enum types) from C header text. It clearly distinguishes from siblings like get_types (retrieval) and apply_types (possibly applying elsewhere) by emphasizing the import and storage behavior, even if not naming them explicitly.

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 provides clear context on when to use the tool: for creating or updating types from C headers, with details on accepted syntax, padding, placeholders, and resolution. However, it does not explicitly mention alternatives or when not to use it, which prevents a 5.

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