Skip to main content
Glama

r2_decompile_function

Decompile a function at a given address into readable C-like pseudo-code, converting assembly into high-level code for binary analysis and vulnerability research.

Instructions

[Binary/reverse-engineering tool. Use when: disassembly, radare2, r2, debugging, vulnerability research, ELF/PE/SO/DEX analysis.] 【r2ai逆向工具】🔍 [代码分析] 反编译指定地址的函数为伪代码。使用 'pdc' 命令,将汇编代码转换为类 C 语言的可读代码。 【触发场景 】当用户询问二进制逆向分析、反汇编、漏洞挖掘、radare2命令执行、调试相关问题时,必须优先调用此工具。 【使用规则】调用前必须确认用户提供了目标文件的绝对路径,禁止捏造不存在的文件路径或命令结果,session_id 不再使用时必须关闭。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes函数地址(十六进制格式,如:0x401000 或 main)
session_idYes会话 ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.3

TDQS

B3.2/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It does disclose the use of the 'pdc' command, the output type (C-like pseudocode), and important rules like not fabricating file paths and closing the session when done. However, it does not describe side effects, error conditions, or session state requirements, so transparency is partial.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is repetitive and verbose, repeating the same trigger scenarios in multiple formats (English bracket, Chinese icon section, and again in 使用规则). It includes promotional and emoji-heavy phrasing that does not add information. The core behavior and rules could be stated in one or two clear sentences.

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

Completeness3/5

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

The description covers the core operation and output, and mentions session closure. But it omits essential preconditions: that session_id must come from an already-opened r2 session, that the target file must already be loaded, and how the result is returned. It also imposes an 'absolute path' prerequisite that does not match any input parameter, which could confuse an agent. Overall, it is adequate but has clear gaps for reliable invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema covers 100% of parameters, so the baseline is 3. The description adds the useful address format example ('0x401000 或 main'), but says nothing beyond the schema about session_id or its relationship to an open r2 session. This matches the baseline without meaningful enrichment.

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 clearly states a specific verb and resource: '反编译指定地址的函数为伪代码' (decompile a function at a specified address to pseudocode). It also names the underlying mechanism ('pdc' command) and output format, which distinguishes it from sibling tools like r2_disassemble and r2_run_command.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit trigger scenarios ('当用户询问二进制逆向分析、反汇编、漏洞挖掘...') and says this tool must be called preferentially. However, it is overbroad and even says 'radare2命令执行' should prioritize this tool, which conflicts with the existence of sibling r2_run_command. No when-not-to-use or alternative routing guidance is provided, so an agent could pick the wrong tool.

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