fix(mcp): function pagination drops blank lines at page boundaries
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 42/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- cpp
調査の方向性
The report identifies bn_function_decompile and bn_function_disassembly in the built-in GUI MCP server, whose implementation ships inside the proprietary application. Start by reading the MCP guide’s “Ranges, Queries, and Pagination” section, then inspect the available tool implementation or tests if accessible. Reproduce with the supplied fixture and compare full output, concatenated pages, and counts while retaining the interior blank line.
索引モデルが issue の本文から書いたものです。
説明
Summary
bn_function_decompile and bn_function_disassembly report line counts that exceed the lines delivered in their fenced code blocks. For decompilation, concatenating successive pages also loses a blank line present in the unpaged output. This makes the text depend on page boundaries and prevents a client from reconstructing the same rendered function by following nextOffset.
Steps to reproduce
- Save the C source below as
fixture.c, compile it, and openfixturein Binary Ninja. Enable and start the built-in GUI MCP server, then connect an MCP client and runtools/list.
#include <stdio.h>
volatile int fixture_global = 7;
__attribute__((noinline, used)) int fixture_leaf(int value) { puts("FIXTURE_LEAF"); return value + fixture_global; }
__attribute__((noinline, used)) int fixture_branch(int value) { return value > 3 ? fixture_leaf(value) : fixture_leaf(-value); }
int main(int argc, char **argv) { return fixture_branch(argc); }
clang -arch arm64 -O0 -g -fno-inline fixture.c -o fixture
-
Call
bn_binary_view_list, select the returned Mach-O view withbn_binary_view_set_active, and wait untilbn_analysis_statusreportsIdleState. Use the returned handle unchanged; handle values are session-scoped. -
Call
bn_function_decompilewith{"function":"_fixture_branch","offset":0,"limit":1000}and count lines inside its code fence, excluding the opening/closing fences. Keep interior blank lines. -
Request the same function with
(offset, limit)values(0, 2),(2, 3),(5, 3), and(8, 5), following each returnednextOffset. Concatenate the code-fence contents without adding separator lines and compare with step 3. -
Call
bn_function_disassemblywith{"function":"_fixture_branch","offset":0,"limit":1000}and compare its metadata with the code-fence line count.
Expected behavior
The tool schemas describe offset as a zero-based line or item offset and limit as the maximum function lines or items returned. The guide instructs clients to continue with nextOffset. Following that pagination should preserve the rendered function, including blank lines that appear inside the unpaged reply, and count should describe the returned lines consistently.
Actual behavior
The full decompile reply reported count: 10, total: 10, but contained eight code lines:
int32_t _fixture_branch(int value)
{
if (value <= 3)
return _fixture_leaf(0 - value);
return _fixture_leaf(value);
}
The four pages returned these results. Counts below include blank lines inside the fence, but exclude the fences themselves.
| offset | limit | count | total | nextOffset | truncated | code lines received |
|---|---|---|---|---|---|---|
| 0 | 2 | 2 | 10 | 2 | true | 1 |
| 2 | 3 | 3 | 10 | 5 | true | 2 |
| 5 | 3 | 3 | 10 | 8 | true | 3 |
| 8 | 5 | 2 | 10 | null | false | 1 |
The concatenated pages contained seven lines: the blank line between the prototype and { disappeared, while the interior blank line in the third page survived. The full disassembly reply similarly reported count: 30, total: 30, but delivered 28 code lines. All observations came from the same analyzed function; the numbers describe this fixture, not a population-wide failure rate.
Evidence
- Expected source: Installed
tools/listschemas for both function rendering tools and the guide's “Ranges, Queries, and Pagination” section; versioned guide links appear under Runtime or environment. - Failure source: Direct raw HTTP
tools/callreplies for the full decompile, four pages, and full disassembly; the exact calls and meaningful results are transcribed above. - Evidence provenance: observed
- Local verification: reproduced
- Reproduction completeness: complete
Restoration check
For the supplied fixture, compare full and paged code-fence text while retaining blank lines: concatenating all pages must produce the same line sequence as the full reply, and each reply's metadata must consistently account for the lines delivered. Check both decompile and disassembly. Retain an interior blank line as a control so a pass cannot result from discarding every blank line.
Runtime or environment
- Binary Ninja Version: Free 6.0.10905-Stable; bundle version
6.0.10905_free; built-in GUI HTTP MCP serverbinaryninja_ui_mcpversion0.1.0. - Edition: Free. OS: macOS 27.2; CPU architecture: arm64. Target: thin arm64 Mach-O built with the command above. Analysis status was
IdleStatebefore the observations. - The official stable release metadata matched the installed build. A fresh profile enabled
ui.mcp.enabled; no user plugins or existing databases were involved. The target was analyzed, never executed, and no database was saved. - The stable MCP guide and the current default-branch MCP guide were compared. Their relevant calling conventions agree. The implementation ships inside the proprietary application, so public default-branch source inspection does not verify its runtime behavior.
- The issue template requests development-build testing. That was not performed: Free cannot switch to the development channel. Personal/Commercial editions, development builds, Windows, and Linux are untested.
References
Closed issue #3292 requested adding arbitrary blank lines in the decompiler UI. Its body and full discussion concern rendering customization, not MCP pagination. This report concerns losing a line already present in the MCP tool's own full reply; it does not request that declined UI feature.
Triage assessment
- Impact level: P2
- Assessment status: supported
- Impact basis: Function text changes when retrieved in pages, and reported counts cannot be reconciled with the delivered code lines. The observed loss is blank-line formatting, not missing instructions or changed analysis.
- Workaround status: available
- Workaround basis: For this small fixture, a single full decompile request preserves the interior blank line that paging loses. This was verified; the workaround does not establish a way to preserve arbitrary larger functions beyond the tool's 1000-line page cap.
- 主要言語
- C++
- スター
- 1.3k
- フォーク
- 304
- 平均マージ
- 2日 20時間
- マージ済み PR(30日)
- 10
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Vector35/binaryninja-api のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
Vector35/binaryninja-api#8715 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Vector35/binaryninja-api#8714 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
Vector35/binaryninja-api#8713 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
Vector35/binaryninja-api#8689 ·
メンテナーはふだん 2 日以内に返信
-
Component: Python API
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Vector35/binaryninja-api#8649 ·
メンテナーはふだん 2 日以内に返信
Vector35/binaryninja-api の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
ESPresense/ESPresense#2680 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1時間未満 初心者へのやさしさ 75/100
stew675/llama-cpp-rdna-boosts#348 ·
メンテナーはふだん 1 日以内に返信
-
Documentation: Add comprehensive newcomer onboarding guide, project structure, and local usage to README対応中かも @Ash-Blanc が今日担当しました。 オープンarea/other status/bot-triaged status/need-triage
難易度 2/5 半日 初心者へのやさしさ 85/100
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信