Skip to content

refactor(mcp): bind the session target, context and process capture tools through the shared table - #11640

Merged
morluto merged 1 commit into
refactor/bind-gdb-cutter-toolsfrom
refactor/bind-session-tools
Nov 16, 2026
Merged

morluto merged 1 commit into
refactor/bind-gdb-cutter-toolsfrom
refactor/bind-session-tools

Conversation

@morluto

@morluto morluto commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Summary

Binds the last five session tools in registerSessionTools.ts (open_binary, open_bundle_resources, get_navigation_context, inspect_address_context, capture_process_scenario) through the shared service binding table, with the three delivery capabilities they needed (coordinator decision): a query binding on the admitted analysis port, oversized-response alternatives for value results, and a detailed failure that keeps open_binary's error format. Stacked on #11637. Refs #10583.

Problem and expected behavior

These tools wired admission, logging and delivery by hand because the table could not express them: value bindings had no access to the analysis admission grants, no overflow alternatives, and no failure that carries facts beside the error (open_binary reports selection_at_failure, target_at_open_completion, provider_id_at_open_completion). Process capture recorded Evidence and residual unknowns inside the server adapter. Expected: each tool is one binding; the shared handlers own admission, logging and delivery; the results and errors are unchanged.

Change and scope

  • src/server/contractToolHandler.ts: value workflows may return ReducibleValue (value + alternatives tried in order when the complete value overflows) or fail with DetailedFailure (error + facts added to its details); the value handler passes the analysis admission grants.
  • src/server/contractToolBindings.ts: new query binding kind ((input, analysis, request) => value), refused at startup when the server admits no analysis, like analyze.
  • src/server/ToolResultDelivery.ts: toOpenFailureToolResult becomes toDetailedErrorToolResult(error, details, targetContent) (same projection, no recovery substitution); toCallToolResult wraps alternatives in result for session contracts like the value itself, so callers no longer pre-wrap them.
  • src/server/admittedToolOperation.ts: passes the granted analysis to the operation.
  • src/application/process/ProcessSessionCapture.ts (new owner): plan or capture a scenario, record its Evidence and each residual unknown in the session; returns { evidence, recorded } so delivery does not record twice.
  • src/server/serviceToolBindings.ts: groups binaryTarget (open_binary, open_bundle_resources: values outside admission, as before), analysisContext (navigation and address context: queries; address context returns a ReducibleValue over omitContextEvidenceForDelivery), processCapture (analyze kind under session admission).
  • src/server/registerSessionTools.ts: 5 registration sites and ~300 lines removed; it keeps lifecycle composition (close, reset, status, process resource cleanup, native function matching). Baseline lowered.

Not included: close_binary, reset_investigation, match_native_functions (their own files), Electron (D7).

Contract and boundary impact

  • Semantic owner and earliest changed stage: MCP registration and delivery; process capture's session recording moves from the server adapter to ProcessSessionCapture (application).
  • Contribution scope fit and linked maintainer decision: coordinator-approved.
  • CLI and MCP/tool-catalog contract: schemas unchanged; no CLI change.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged; capture Evidence and residual unknowns recorded as before.
  • Target selection, authority, upstream behavior, and cleanup details: open runs outside admission and orders itself in the session as before; context reads and capture run under session admission as before; capture resources stay owned by the server's ProcessCaptureResourceScope.
  • Generated metadata, package, or installation impact: none.

Behavior visible to MCP clients (no result or error shape changes):

  • get_navigation_context and inspect_address_context calls are now logged by the shared handler (they were not logged).
  • capture_process_scenario now reports operation start and end progress (as every analyze workflow does) around its existing capture progress, when the client requests progress.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Added (tests/boundary/mcp/contractToolBindings.test.ts): a query receives exactly the analysis its admission grants, is admitted under its own tool name, and a server that admits none refuses the binding at startup.
  • Updated: oversizedErrorDeliveryMcp.test.ts drives toDetailedErrorToolResult with the open-failure facts (oversized open failure still delivered within budget).
  • Existing coverage through the bound tools: open failure details (providerSelectionMcp: selection_at_failure, target_at_open_completion), address-context overflow alternatives (contextEvidenceOverflow, addressContextCapacity), navigation (navigationContextMcp), address input errors and bookmarks, capture Evidence identity, residual unknowns and cleanup (processEvidenceIdentityMcp, processCaptureCleanupSchema, serverUnknownsMcp, shutdown), session target requirements, tool families and catalog identity.
  • Known failure unrelated to this PR: providerSelectionMcp "reports confirmed snapshot binding differences" fails on main since feat(snapshots)!: persist the target identity as the snapshot target #11551 (stale expectation; fixed by test(snapshots): expect a snapshot binding mismatch to name targets by their persisted identity #11639). It fails at the binding_mismatch assertion, after the open-failure detail assertions pass.
  • Remaining proof gaps: no real provider runs here.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- tests/boundary/mcp/contractToolBindings.test.ts — 5 passed
  • npm run test:focused -- tests/boundary/mcp/contextEvidenceOverflow.test.ts tests/boundary/mcp/addressContextCapacity.test.ts tests/boundary/mcp/navigationContextMcp.test.ts tests/boundary/mcp/addressContextInputErrors.test.ts tests/boundary/mcp/addressContextBookmarks.test.ts tests/boundary/mcp/oversizedErrorDeliveryMcp.test.ts tests/boundary/mcp/processEvidenceIdentityMcp.test.ts tests/boundary/mcp/processCaptureCleanupSchema.test.ts tests/boundary/mcp/sessionMcp.test.ts tests/boundary/mcp/sessionTargetRequirements.test.ts tests/boundary/mcp/shutdown.test.ts tests/boundary/mcp/toolResult.test.ts — 109 passed
  • npm run test:focused -- tests/boundary/mcp/serverUnknownsMcp.test.ts tests/boundary/mcp/processComparisonVerificationMcp.test.ts tests/boundary/mcp/processComparisonDiagnosticsMcp.test.ts tests/boundary/mcp/processTraceAdaptersParity.test.ts tests/boundary/mcp/hostRestrictedAvailabilityMcp.test.ts tests/boundary/mcp/toolFamiliesMcp.test.ts tests/boundary/mcp/serverIdentity.test.ts tests/boundary/mcp/idaToolEffects.test.ts tests/boundary/mcp/evidenceBundleInline.test.ts tests/boundary/mcp/sourcePublicationContext.test.ts tests/boundary/mcp/guidedWorkflowsMcp.test.ts tests/boundary/mcp/compactInputSchemaMcp.test.ts src/server/sessionDerivedArtifactComparison.test.ts tests/boundary/mcp/providerSelectionMcp.test.ts — 118 passed, 1 failed (the main failure above)
  • npm run check:fast — passed; npx oxfmt --check . — passed; architecture guards (baseline lowered) — passed; pre-push hook — passed

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none in this PR.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: admission and capture resource ownership unchanged.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

…ools through the shared table

Value bindings can return a ReducibleValue (alternatives tried when the complete value overflows) or a DetailedFailure (facts delivered beside the error's details). A new query binding reads the analysis its required admission grants. open_binary and open_bundle_resources bind as values; get_navigation_context and inspect_address_context as queries; capture_process_scenario on the analyze kind through an application owner that records its Evidence and residual unknowns.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T01:24:00.105564Z
We couldn’t complete this review. Comment @codex review to try again.
0d44587 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Moves five session tools into the shared binding table and moves process-capture recording into ProcessSessionCapture.ts.

  • Shared contract bindings can run admitted value queries and shape their delivery.
  • Binary and bundle opening use the shared session handler.
  • Context reads use the shared session handler and are logged.
  • Process capture reports shared progress and records its Evidence in the session.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[MCP request] --> B[Shared binding table]
  B --> C[Binary target value]
  B --> D[Admitted context query]
  B --> E[Admitted process capture]
  C --> F[Session opens target]
  D --> G[Granted analysis]
  E --> H[Capture and record Evidence]
  F --> I[Shared delivery]
  G --> I
  H -->|Reuse recording receipt| I
Loading

Reviews (2) · Last reviewed commit: "refactor(mcp): bind the session target, ..." · Reviewed by Greptile

@morluto
morluto merged commit e7204b9 into refactor/bind-gdb-cutter-tools Nov 16, 2026
2 checks passed
@morluto
morluto deleted the refactor/bind-session-tools branch November 16, 2026 01:28
morluto added a commit that referenced this pull request Nov 16, 2026
…ssion through the shared table (#11637)

* refactor(mcp): bind GDB and Cutter tools under external-mutation admission through the shared table

GDB start and status, and Cutter discovery, bind as values outside admission; gdb_console and cutter_command bind on the external-mutation evidence kind (gdb_console with delivery detail), and close_gdb_session on owned-cleanup. Tests build their servers through one debugger fixture, and the Rizin lifecycle regressions now run for all three debuggers.

* refactor(mcp): bind the session target, context and process capture tools through the shared table (#11640)

Value bindings can return a ReducibleValue (alternatives tried when the complete value overflows) or a DetailedFailure (facts delivered beside the error's details). A new query binding reads the analysis its required admission grants. open_binary and open_bundle_resources bind as values; get_navigation_context and inspect_address_context as queries; capture_process_scenario on the analyze kind through an application owner that records its Evidence and residual unknowns.
@morluto morluto added the area: mcp MCP server, transport, and tool registration label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: mcp MCP server, transport, and tool registration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant