Repository navigation
refactor(mcp): register service-backed tools through one contract binding loop - #11264
Merged
Merged
Conversation
…ding loop registerContractTools registers every bound contract from the registry through the shared Evidence or retained-summary handler its binding selects, and refuses a binding that names no registered contract. createServer declares the bindings by exact contract name; 41 per-tool register files are deleted.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
[Medium impact] The PR appears safe to merge; no blocking issue remains. SummaryMoves service-backed MCP registration into
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A["createServer: supplied services"] --> B["serviceToolBindings: named bindings"]
B --> C["registerContractTools"]
D["TOOL_CONTRACTS"] --> C
C --> E["Choose registration options"]
E --> F{"Binding handler"}
F --> G["createEvidenceToolHandler"]
F --> H["createRetainedSummaryToolHandler"]
G --> I["server.registerTool"]
H --> I
Reviews (3) · Last reviewed commit: "test(mcp): assert binding exclusivity wi..." · Reviewed by Greptile |
Merged
19 tasks
…ke each binding select one handler serviceToolBindings owns the binding of every service-backed contract, keyed by its service; createServer and the MCP tests bind from it, so tests exercise the production handler kind, admission and dependencies. A binding can no longer carry both run and summary. The Go real-binary workflow follows the new registration owners.
morluto
requested review from
N0zoM1z0,
gensokyo-dev and
kaoru0822-kitauji
as code owners
November 15, 2026 15:21
…d under every checker
19 tasks
mvanhorn
added a commit
to mvanhorn/rea
that referenced
this pull request
Nov 15, 2026
Main replaced the per-tool register files with the service binding table (morluto#11264) and declares standalone availability on contracts (morluto#11262), so inspect_deb_package now binds through serviceToolBindings, declares availability "standalone", and registerDebPackageTool.ts is removed. The default MCP profile no longer lists output schemas (morluto#10693), so the deb MCP test validates the canonical contract output schema instead.
Plastic-time
added a commit
to Plastic-time/rea
that referenced
this pull request
Nov 15, 2026
Main morluto#11264 registers service-backed MCP tools through one binding table, and morluto#11270 declares tool availability on the contract. The merge takes main's createServer.ts and CapabilityInventory.ts, then: - binds inspect_pe_rich_header in serviceToolBindings.ts and passes the service to registerServiceTools, like inspect_pe_imports; - marks the contract "standalone"; - removes registerPeRichHeaderTool.ts, as main removed its siblings.
20 of 29 tasks
This was referenced Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of plan W1 (one owner for adding a tool). Every service-backed MCP tool had its own
src/server/register*.tsfile: about 25 lines that resolvedtoolContract(name), wrapped one service method increateEvidenceToolHandlerorcreateRetainedSummaryToolHandler, pickedtoolRegistrationOptionsorapplicationToolRegistrationOptions, and calledserver.registerTool. Adding a tool meant adding another copy and wiring it intocreateServer.registerContractToolsinsrc/server/contractToolBindings.tsis now the single registration loop for those tools.createServerdeclares one binding per contract name, and the loop registers each bound contract from the registry through the shared handler its binding selects. 41 register files are deleted.Refs #10583
Problem and expected behavior
Expected: adding a service-backed MCP tool touches its contract and one binding entry, with the handler and registration options chosen by one owner. Before: a new
register*.tsfile, an import and a call increateServer, and a per-file choice of handler and registration options that could drift (for example,inspect_byte_entropyandinspect_native_exportsboth use the retained-summary handler but different admission).Change and scope
src/server/contractToolBindings.ts(new owner):ContractToolBindingsis keyed by exact catalog contract name. Each binding declaresadmission: "sdk" | "application"(who validates the raw request: the SDK through the contract request frame, or the application workflow) and eitherrun(Evidence handler) orsummary(retained-summary handler).summaryis only accepted for contracts whose input selectsdetail; this is checked at compile time, and a test pins it with@ts-expect-error.contractServiceBindings(service, names)binds the named operations of aContractToolService(ADB, JEB, Apktool, firmware, Flutter, pcap).registerContractTools(server, bindings, dependencies, contracts = TOOL_CONTRACTS)iterates the registry, registers every bound contract, and throws at startup when a binding names no registered contract.runandsummaryexclude each other in the type.src/server/serviceToolBindings.ts(new):SERVICE_TOOL_BINDINGSis the one table of these bindings, keyed by the service that runs them, with each entry's production admission, handler kind and retention.registerServiceTools(server, services, dependencies)registers the supplied services.createServerand the MCP tests both bind from it, so a test covers the production wiring.src/server/createServer.ts: the families keep their call sites and order. Each run of simple registrations is now oneregisterServiceToolscall naming its services.inspect_byte_entropymoves out ofregisterBinaryDiagnosticsTools, which keeps only the bespokeinspect_binary_layout.scripts/ci/scopes.mjs: the deleted paths are removed from their scopes; the new owners stay unscoped, so changing them takes the full-suite fallback..github/workflows/real-go-binary.ymlwatches the new owners instead of the deletedregisterGoTools.ts.tests/evaluation/ciTestSelection.test.tsuses the new owner as its MCP-implementation sample.Not included (named exceptions that keep their own register files, because their registration is not one service call per contract): sessions, session status and records, guidance, prompts, analysis settings and views, evidence, investigation, enhanced and official proxy tools, reverse-engineering, Cutter, GDB, Rizin, Frida, browser, electron, web runtime and network capture, JavaScript runtime observation, Android, managed, application, desktop build, comparisons, close lifecycle, web script, native function matching. Moving their simple members onto the loop is follow-up work. Capability availability (
CapabilityInventory) andtoolEffects.tsare separate W1 items.Contract and boundary impact
registerContractToolsowns MCP registration for bound contracts. The handlers (createEvidenceToolHandler,createRetainedSummaryToolHandler) and registration options are unchanged and are now chosen in one place. The superseded per-tool files are deleted.npm run verify:advertised-schemasreports the committed summary current.docs/public/product-catalog.json), package, or installation impact: none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
tests/boundary/mcp/contractToolBindings.test.ts(new):tools/listand dispatched to its binding from the binding alone, with no register file.summaryis refused for a contract withoutdetail, and a binding with bothrunandsummaryis refused.registerServiceTools:binaryDiagnosticsMcp,devicetreeMcp,erlangBeamMcp,evmInterfaceMcp(including its duplicate-registration refusal),modelArtifactPartialReadFailureandprocess-global/modelHostReadFailure.Validation performed
npm run test:focused --with the new test, the six migrated test files,tests/evaluation/ciTestSelection.test.ts,toolSchemaValidity,toolFamiliesMcp,clientCapabilities,advertisedCatalogSummaryand the MCP tests of the migrated tools (apktool, appleIps, binaryHardening, desktopApplication, elfNotes, elfUnwindRanges, firmware, flutter, goBinary, javascriptRecovery, jeb, kernelBuildConfig, kernelModule, packetCapture, pcap, peCertificates, peImports, peLoadConfig, pythonPyc, recordedCrash, releaseExposure, adb, nativeInitializers, rustBinary, signalRecording, v8CodeCache, wasmArtifact, webModuleTrace, webSourceLocation, windowsShortcut): 40 files passed and 2 skipped; 222 tests passed and 4 skipped.npx oxfmt --check .: passed.npm run check:fast(typecheck and lint): passed.node scripts/verify/architecture-guards.mjs: passed.npm run verify:advertised-schemas: passed (summary current).check:fast, the guards andverify:advertised-schemaswere repeated: all passed (40 files passed and 2 skipped; 222 tests).Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.