How to read memory and resolve global variables with ida-pro-mcp?
I'm using ida-pro-mcp with an LLM client and need it to read memory at an address and resolve global variable values, but I can't find a memory API in the tool. Which functions were added for this, and should the LLM be allowed to call raw byte reads directly?
Originally asked on GitHub: https://github.com/mrexodia/ida-pro-mcp/issues/54
5 answers
Fixed in PR #82 (issue closed June 2025). The merged PR added two memory functions:
get_memory_bytes(address, size), which returns the requested bytes as a hex-formatted string, andget_global_variable_value(name), which resolves the variable's width from its IDA type and returns the value in the matching form.The exact API proposed in this issue (
data_read_byte/word/dword/qwordreturninghex(value),data_read_string, andget_memory_bytesreturninglist[int]) was not what landed. The maintainer's main concern was avoiding the LLM calling raw memory reads to "disassemble in its head", which tends to produce hallucinations. He considered raw bytes mainly useful for extraction tasks, like building a unicorn emulation script, while typed/global accessors are better for reading vtables and globals.The thread does not settle the raw-bytes design question. One contributor reported that a previous agent's
read_bytes(address)helper, which always returned exactly 8 bytes and was clearly documented as such, worked well and reduced the number of choices the LLM had to make. Another contributor found Claude preferred a rawget_bytesfunction and did anntohsconversion correctly, but used math functions instead of binary operations, which is fragile.General advice: prefer
get_global_variable_valuefor named data, and treatget_memory_bytesas a last resort for copying data out.Did this work for you?What @withzombies tried on GitHub (Worked)
The contributor's PR #82 implemented
get_memory_bytes(address, size)returning hex-formatted bytes andget_global_variable_value(name)which resolves the value width from the IDA type. The maintainer closed the issue via this PR.Source: https://github.com/mrexodia/ida-pro-mcp/issues/54#issuecomment-2944186809 (opens external site)
Did this work for you?What a GitHub user tried on GitHub (Outcome unclear)
The issue body proposed an API with
data_read_byte/word/dword/qword,data_read_string, andget_memory_bytes(address, size) -> list[int]usingidc.get_bytes. This was presented as a design proposal, not a tested implementation.Source: https://github.com/mrexodia/ida-pro-mcp/issues/54 (opens external site)
Did this work for you?What @williballenthin tried on GitHub (Worked)
In a previous agent, one contributor used a
read_bytes(address)helper that always returned 8 bytes and was clearly documented as such. They found the LLM handled interpreting little/big endian data well with this single fixed-width interface.Source: https://github.com/mrexodia/ida-pro-mcp/issues/54#issuecomment-2962763082 (opens external site)
Did this work for you?What @withzombies tried on GitHub (Partly worked)
A contributor's branch provided typed data accessors based on IDA type info (falling back to the named item's size) plus a
get_bytesfunction. Claude preferred the rawget_bytesfunction and performed anntohsconversion correctly, but used math functions instead of binary operations, which raised robustness concerns.Source: https://github.com/mrexodia/ida-pro-mcp/issues/54#issuecomment-2963685268 (opens external site)
Did this work for you?
Related questions
- How can I make ida-pro-mcp return the real error when rename, xrefs, or decompilation fails?
- ida-pro-mcp: AttributeError: ida_kernwin has no attribute parse_tagged_line_sections
- How do I enable or disable specific tools in ida-pro-mcp?
- Does ida-pro-mcp support multiple IDA Pro instances?
- ida-pro-mcp rename tool fails: server reads `batch["func"]` but Claude sends `functions`