Skip to main content
Glama

r2_manage_xrefs

Manage cross-references in binary analysis to trace callers, locate string usage, or fix missing references by listing, adding, or removing code/data references.

Instructions

[Binary/reverse-engineering tool. Use when: disassembly, radare2, r2, debugging, vulnerability research, ELF/PE/SO/DEX analysis.] 【r2ai逆向工具】🔗 [交叉引用管理] 管理代码和数据的交叉引用(Xrefs)。用于查询'谁调用了函数'、'字符串在哪里被使用',或手动修复缺失的引用关系。 操作类型说明:

  • 'list_to' (axt): 查询引用了目标地址的位置(例如:谁调用了这个函数?)。

  • 'list_from' (axf): 查询目标地址引用了 哪些位置(例如:这个函数里调用了谁?)。

  • 'add_code' (axc): 手动添加一个代码引用(修复未识别的跳转)。

  • 'add_call' (axC): 手动添加一个函数调用 引用。

  • 'add_data' (axd): 手动添加一个数据引用(如指针指向)。

  • 'add_string' (axs): 手动添加一个字符串引用。

  • 'remove_all' (ax-): 删除指定地 址的所有引用(修复错误的分析)。 【触发场景】当用户询问二进制逆向分析、反汇编、漏洞挖掘、radare2命令执行、调试相关问题时,必须优先调用此工具。 【使用规则】调用前必须确认用户提供了目标文件的绝对路径,禁止捏造不存在的文件路径或命令结果,session_id 不再使用时必须关闭。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYes要执行的操作类型
session_idYes会话 ID
source_addressNo源地址(可选)。对于添加操作(add_*),这是发出引用的位置。如果不填,默认为当前光标位置。
target_addressYes目标地址或符号(例如 '0x00401000', 'sym.main', 'entry0')。对于添加操作, 这是引用指向的目标。

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?

没有注释信息,所以描述承担了行为披露责任。描述明确列出了 add_code/add_call/add_data/add_string/remove_all 等写操作及其含义,能让代理知道这些会修改分析结果;也提到了“修复错误的分析”。但它没有说明修改是否会持久化、是否需要已有打开的文件、session_id 如何获得,以及操作可能的副作用。

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

Conciseness3/5

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

描述结构清晰,操作列表分段明确,但篇幅偏长,且夹杂了图标、大段‘触发场景’和‘使用规则’。其中“必须确认目标文件绝对路径”与当前参数列表没有直接对应关系,显得冗余甚至干扰。整体信息密度尚可,但不够精炼。

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?

工具涉及 7 种操作且无输出 schema,描述对每种操作都给出了说明,基本能指导代理选择 action 和填写参数。但缺少关键前置条件说明,比如 session 如何获得、目标文件是否已打开;同时“必须确认绝对路径”这一规则与本工具参数不一致,造成上下文不完整。

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 覆盖率为 100%,因此已含参数基础描述;但说明进一步把 action 枚举值映射到 radare2 命令(axt/axf/axc/axC/axd/axs/ax-),并解释了 list_to 与 list_from 的区别,以及 source_address 的默认行为。这明显补充了 schema 之外的含义。

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

描述以“管理代码和数据的交叉引用”开头,明确给出了具体动词和资源,并列出 list/add/remove 等操作,说明这是一对引用进行查询和修改的工具。虽然与同族的 r2_get_xrefs 在查询类操作上可能存在重叠,但整体上仍足以让代理辨明其主要职责。

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?

描述包含“触发场景”,但范围过于宽泛,声称逆向分析、反汇编、漏洞挖掘、调试等场景“必须优先调用此工具”,这会把代理错误地引导到一个只管理 Xrefs 的工具上,而非真正的反汇编或调试工具。没有说明何时不应使用本工具,也没有与 r2_get_xrefs、r2_run_command 等替代工具进行区分。

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