Skip to content

fix: add return type annotations to avoid pydantic errors#65

Open
renato-osec wants to merge 7 commits intofosdickio:mainfrom
renato-osec:fix-type-annotations
Open

fix: add return type annotations to avoid pydantic errors#65
renato-osec wants to merge 7 commits intofosdickio:mainfrom
renato-osec:fix-type-annotations

Conversation

@renato-osec
Copy link
Contributor

Adds proper return type annotations to all @mcp.tool() functions to satisfy pydantic validation in mcp >= 1.26

renato-osec and others added 7 commits February 13, 2026 20:31
- function_at: use non-blocking get_function_at first, fall back to
  iterating bv.functions during analysis, auto-create function if missing
- get_binary_status: expose analysis_state, analysis_complete, function_count
- Tool docstrings: add agent workflow tips (call make_function_at before
  decompile/get_il on unanalyzed addresses to avoid hangs)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…naries

update_analysis_and_wait() blocks the HTTP handler thread until Binary
Ninja finishes analyzing the entire binary, which can take 30+ minutes
for large (88MB+) binaries. Switch to non-blocking update_analysis()
and only trigger re-analysis if the function was actually skipped.
…tion

On large binaries (25k+ functions), background analysis holds locks that
cause func.hlil/mlil to block indefinitely. abort_analysis() breaks IL
generation entirely (returns None).

Instead, use WorkflowMachine(func.handle).run() which runs analysis for
just the requested function (~0.03s) without contending with background
analysis workers. Background analysis continues undisturbed.

Tested: 88MB binary, 25k functions — decompile returns 180 HLIL
instructions in <0.05s even with background analysis active.
- Try hlil_if_available first (instant, no side effects)
- Only call WorkflowMachine.run(incremental=True) if IL not cached
- incremental=True avoids resetting function analysis state which
  was stopping BN's background analysis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant