Skip to main content

Module protocol

Module protocol 

Source
Expand description

Cross-language wire DTOs for the M1a read tools (spec §3). These are the worker’s response shapes; the server canonicalizes address strings (via address::AddressCanonicalizer) before returning them to the MCP client, but the wire form carries whatever space:offset the worker emits.

Schema-stability contract (spec §3.5): these shapes are a BASELINE. Later milestones may only ADD keys; renaming/retyping/removing an M1a field requires a NEW MCP tool name.

Structs§

AddressInfo
describe_address result (spec §3.x): a TOTAL address -> what-is-here point lookup, the dual of resolve_symbol. An unmapped/unparseable address is a valid answer (mapped: false), never an error. address echoes the request (raw space:offset when mapped; the handler canonicalizes it).
AddressSymbol
The primary symbol at an address, from describe_address. kind is a lowercase Ghidra classification string (NOT a Rust enum), mirroring Symbol::kind.
AttachResult
The attach_program / worker_info shared result: the worker reports the attached program’s address geometry so the server can build an AddressCanonicalizer for it (spec §3.2 + §6). This is strictly-additive to the M0 {attached} shape.
CallEdge
One call-graph neighbor of a function (spec §3.3). address is a raw space:offset string as emitted by the worker; the server re-renders it through AddressCanonicalizer before it reaches the agent. external: true marks an imported-DLL thunk with no decompilable body (spec §3.3 round-7 seat-3) — the agent identifies it by name, never feeds it back to inspect_function.
CommentEntry
One comment surfaced by inspect_function (M2b read-back tidy). address is a raw space:offset string as emitted by the worker; the handler canonicalizes it alongside the other FunctionContext addresses. kind is the comment channel (eol|pre|post|plate|repeatable); comment is the text.
CommentResult
Result of the comment write tool (M2b §3.1). previous_comment is present only when a prior non-empty comment was overwritten or cleared. address is canonicalized by the rmcp handler.
ContainingFunction
The function containing an address, from describe_address (spec §3.x). entry_point is a raw space:offset string as emitted by the worker; the handler canonicalizes it.
DataItem
One defined data instance from list_data_items (spec §3.x). address is a raw space:offset string as emitted by the worker; the handler canonicalizes it. name is the listing label when one is present (else absent); value is present only when the worker could cheaply render it.
DataRef
One from-data reference gathered from inspectFunction’s body (Task 16). address is a raw space:offset string as emitted by the worker; the handler canonicalizes it alongside the other FunctionContext addresses. name is the primary symbol at the target address when one exists. ref_type is the Ghidra RefType name (e.g. “DATA”, “READ”, “WRITE”).
DataTypeInfo
get_datatype result (spec §3.x): looks up a data type DEFINITION by name. members is present for struct/union kinds, values for enum kinds; both absent for any other kind (e.g. a typedef or built-in scalar), which reports only name/kind/size.
DataTypeMember
One field of a struct/union data type, from get_datatype (spec §3.x). type_ serializes as the wire key type (a Rust keyword-adjacent rename, not a shape change).
Disassembly
get_disassembly result (paginated). total is the EXACT instruction count of the resolved function’s body (cheap to compute for one bounded function — unlike the filtered-table tools).
EnumValue
One named value of an enum data type, from get_datatype. value is a String (not a number): Ghidra enum constants can be full 64-bit values, and a bare JSON number would lose precision for the high end of that range (spec §10.8) — the agent must parse it itself.
FunctionContext
The result of inspect_function (spec §3.3). c is capped from the top by max_c_lines (signature + decls always intact — spec §3.4); c_truncated signals the body was longer.
FunctionSummary
One row of find_functions (spec §3.1): the cheap metadata subset of FunctionContext — NO decompiled C, NO edges. address fields are raw space:offset; the handler canonicalizes them.
Instruction
One instruction row from get_disassembly. address is a raw space:offset string as emitted by the worker; the handler canonicalizes it. bytes is lowercase hex. comments mirrors the wire object keyed by comment channel (eol|pre|post|plate|repeatable), present only when a comment exists at this address (M2b read-back tidy — aligned to the wire in M2c Task 0.1).
ListDataItems
list_data_items result (paginated). total present only for cheap exact counts (§3.0) — the M1b worker does not emit it today, so it always deserializes as absent/None.
ListFunctions
find_functions result (spec §3.1). total present only for cheap exact counts (§3.0).
ListProjectPrograms
The full list_project_programs result (spec §3.1, paginated).
ListSegments
list_segments result (spec §3.x): the full memory map. NOT paginated — segment counts are small.
ListStrings
list_strings result (spec §3.4, paginated). total present only for cheap exact counts (§3.0).
ListSymbols
list_symbols result (spec §3.3, paginated). total present only for cheap exact counts (§3.0).
LocalEntry
One local variable of a function, sourced from the decompiler HighFunction (so the name matches the c body the agent reads) — NOT the Program-DB listing. storage (stack:-0x18, EAX:4, unique:…) is the STABLE primary handle a set_local write keys on; name is a convenience selector that the decompiler may silently re-derive across edits. kind ∈ stack|register|unique|other tells the agent which handles are trustworthy across edits. type_ serializes as the wire key type, mirroring ParamEntry.
ParamEntry
One parameter of a function’s structured signature (read side of inspect_function.prototype; M2c Task 0.2). name is Ghidra’s DB parameter name (auto-named param_1… when the binary has no symbol); type_ serializes as the wire key type. Mirrors the write-side SetPrototypeArgs.params element so a read prototype can be edited and bounced straight back to set_prototype.
ProgramEntry
One row of list_project_programs (spec §3.1). program_path is the absolute /-VFS path used by attach_program. language_id/size come from cheap DomainFile metadata (may be absent).
Prototype
The current signature of a function, structured (read side; M2c Task 0.2). Sourced from the Program DB Function.getSignature() — NOT the decompiler HighFunction, which infers params not locked in the DB (the CAS/write only operate on the DB signature). Mirrors SetPrototypeArgs exactly so the write-loop closes from one read: inspect → mutate one field → set_prototype.
ReadBytes
read_bytes result (spec §3.x): a raw byte dump at address (which echoes the address actually read, i.e. address + offset). bytes is lowercase hex, length the number of bytes actually returned (may be less than requested if clamped). truncated is true when the requested length was clamped down to the 4096-byte cap.
Reference
One cross-reference row from get_xrefs (spec §3.x). from_address/to_address are raw space:offset strings as emitted by the worker; the handler canonicalizes both. ref_type is the Ghidra RefType name (e.g. “CALL”, “DATA”, “READ”). from_function is present only when the reference’s source address falls inside a defined function.
RenameResult
Result of the rename write tool (spec §3.4). previous_name is present only for status="renamed". The address is the raw worker string; the rmcp handler canonicalizes it (spec §3.4).
ResolveSymbol
resolve_symbol result (spec §3.2): every symbol matching the requested name.
Segment
One memory block from list_segments (spec §3.x). start/end are raw space:offset strings as emitted by the worker; the handler canonicalizes both.
SetDatatypeResult
Result of the set_datatype write tool (M2b §3.2). status is "set" | "cleared" | "already_applied"; datatype is the final resolved display name ("undefined" after a clear). previous_datatype is present only when a prior type was replaced/cleared. address is canonicalized by the rmcp handler.
SetLocalResult
Result of the set_local write tool (M2d §4.1). status ∈ set | renamed | retyped | already_applied (a combined type+name change ⇒ set). storage is the canonical handle that was edited (retry-stable for stack locals); name/type are the NEW current values. previous_name is present only when new_name was given AND the name actually changed; previous_type only when new_type was given AND the type actually changed (panel R1-Seat2). function echoes the function name. type_ serializes as the wire key type.
SetPrototypeResult
Result of the set_prototype write tool (M2c §3). status is "set" | "already_applied"; signature is the NEW canonical DB prototype string; previous_signature is present only when a prior signature was overwritten. address (the function entry point) is canonicalized by the rmcp handler. name echoes the function name.
StringItem
One row of list_strings (spec §3.4). address is a raw space:offset string as emitted by the worker; the handler canonicalizes it. encoding is the Ghidra data type name (e.g. “string”, “unicode”).
Symbol
One symbol row, shared by resolve_symbol and list_symbols (spec §3.2/§3.3). Uniform shape; optional fields absent when N/A. kind is a lowercase Ghidra classification string (NOT a Rust enum).
SymbolCandidate
One ambiguous-symbol candidate, carried in an AMBIGUOUS_SYMBOL error’s details.candidates (spec §6). The agent re-calls inspect_function with the disambiguating address.
Xrefs
get_xrefs result (paginated). total present only for cheap exact counts (§3.0).