fix(mcp): function pagination drops blank lines at page boundaries
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- cpp
- Ambito
- backend-api-design
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- C++
- Stelle
- 1.3k
- Fork
- 304
- Merge medio
- 2g 20h
- PR unite (30g)
- 10
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Vector35/binaryninja-api
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
Vector35/binaryninja-api#8715 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Vector35/binaryninja-api#8714 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
Vector35/binaryninja-api#8713 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
Vector35/binaryninja-api#8689 ·
I maintainer di solito rispondono entro 2 giorni
-
Component: Python API
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Vector35/binaryninja-api#8649 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di Vector35/binaryninja-api
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
ESPresense/ESPresense#2680 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 75/100
stew675/llama-cpp-rdna-boosts#348 ·
I maintainer di solito rispondono entro 1 giorno
-
Documentation: Add comprehensive newcomer onboarding guide, project structure, and local usage to READMEForse già presa @Ash-Blanc l’ha presa oggi. Apertaarea/other status/bot-triaged status/need-triage
Difficoltà 2/5 Mezza giornata Idoneità per principianti 85/100
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno