Skip to content

refactor(contracts): register CLI and MCP tools by family id - #8051

Merged
morluto merged 2 commits into
mainfrom
cursor/tool-family-registrars-80f0
Oct 29, 2026
Merged

morluto merged 2 commits into
mainfrom
cursor/tool-family-registrars-80f0

Conversation

@morluto

@morluto morluto commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

CLI and MCP now register tools by walking the published family id list. Adding a family id requires a registrar on both adapters, and TypeScript rejects a missing one. The walker lives with the id list, so a fresh CLI process does not load every tool contract. Web script commands are registered with the application family on both adapters.

Problem and expected behavior

Tool registration was a hand-written sequence in src/cli.ts and src/server/createServer.ts. A new family could be added to the catalog without either adapter registering it. Both adapters should register every published family, in that family's catalog order, while still registering the same commands and tools. CLI startup, including help and setup, should not load the contract tables just to walk the ids. export_web_scripts, trace_web_module_imports, and trace_web_source_location belong to the application family in the catalog, so both adapters register them there.

Change and scope

registerToolFamilies lives in src/contracts/toolFamilyIds.ts and walks TOOL_FAMILY_IDS. createCli and createServer each pass a Record<ToolFamilyId, Registrar>. Setup commands stay outside the list because they are host lifecycle commands, not a tool family. Enhanced MCP workflows stay with core CLI analysis, so that CLI registrar is empty. Session CLI registration is match-native-functions, whose contract is in the session family.

Registration order now follows the published family list. The set of CLI commands and MCP tools is unchanged. Follow the contribution scope.
Ordinary refactor of existing registration. Not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: TOOL_FAMILY_IDS owns family order. CLI and MCP consume it when they build the process. No provider or evidence producer changed.
  • Contribution scope fit and linked maintainer decision: not applicable
  • CLI and MCP/tool-catalog contract: same command and tool names. Registration order follows TOOL_FAMILY_IDS. Web script commands and tools are both application-family registrations.
  • Provider, bridge, target-format, or platform compatibility: none
  • Evidence, artifact, provenance, or reconstruction contract: none
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): none
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none

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

  • Tests added or updated: src/contracts/toolFamilies.test.ts asserts registrar invocation follows TOOL_FAMILY_IDS. tests/boundary/cli/cliToolFamilyOwners.test.ts asserts the CLI imports only the id module and that the three web script commands are application-owned on both adapters, matching toolFamilyId.
  • Base reproduction or other evidence: source-derived. Greptile found the CLI import of toolFamilies.ts and the browser-versus-application split for web script commands.
  • User-visible CLI/MCP output (if applicable): help and tools/list order can follow family order. Names are unchanged.
  • Remaining proof gaps: no snapshot of the previous tools/list index order.

For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.

CLI command coverage and the MCP package catalog check the registered names. Lifecycle regressions are not applicable.

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 format:check — all matched files use the correct format
  • npm run check:fast — typecheck and lint succeeded
  • npm run test:focused -- src/contracts/toolFamilies.test.ts tests/boundary/cli/cliToolFamilyOwners.test.ts tests/boundary/cli/cliToolCoverage.test.ts tests/boundary/cli/dispatcher.test.ts — 21 passed

Compatibility, safety, and release

  • Breaking changes or migration steps: none
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable
  • Package or release metadata impact: none
  • Security, privacy, process, or containment review: none

Author readiness

Human owner: @morluto

  • 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.
Open in Web Open in Cursor 

Walk the published tool-family list once for each adapter so a new
family id must supply both a CLI registrar and an MCP registrar.
@cursor

cursor Bot commented Oct 29, 2026

Copy link
Copy Markdown

@gensokyo-dev @dandgabr Tool registration now walks the published family id list. CLI and MCP each have an exhaustive registrar map, so a new family id fails typecheck until both adapters register it.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-29T20:07:10.476529Z
We couldn’t complete this review. Comment @codex review to try again.
d263cb8 New commits
ℹ️ 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.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Medium impact] The PR appears safe to merge; both previous findings are fixed and no new actionable issues were found.

Summary

CLI and MCP now register tools through complete maps keyed by ToolFamilyId, following TOOL_FAMILY_IDS order.

  • CLI and MCP tools now register in published family order.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  CLI["createCli registrar map"] --> Walker["registerToolFamilies"]
  MCP["createServer registrar map"] --> Walker
  IDs["TOOL_FAMILY_IDS"] --> Walker
  Walker --> Calls["Call each family registrar in published order"]
Loading

Reviews (2) · Last reviewed commit: "fix(cli): keep family registration off t..." · Reviewed by Greptile

Comment thread src/cli.ts Resolved
Comment thread src/cli.ts Resolved
Walk family ids from the startup-safe list, and register the web script
commands with the application family that owns their MCP contracts.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto
morluto merged commit 1c14f66 into main Oct 29, 2026
40 of 42 checks passed
@morluto
morluto deleted the cursor/tool-family-registrars-80f0 branch October 29, 2026 20:25
moah0911 added a commit to moah0911/rea that referenced this pull request Nov 6, 2026
…uidance

Resolve conflicts in CapabilityInventory.ts, createServer.ts, and
registerSessionTools.ts.

Main's morluto#8532 made unavailable ProviderAvailability carry the owner's
remediation next to its reason, which is the same provider-ownership rule this
change threads through AndroidAnalysisPort.setupGuidance. The resolutions keep
both: availability remediation is the primary source, provider setup guidance
(with the pinned JAR URL and SHA-256) replaces the two hardcoded literals main
added to the application and server layers, and the reason field keeps
reporting the observation rather than the repair.

Main's morluto#8051 moved session registration into a family callback that already
supplies the availability probes, so the standalone block is dropped in favour
of adding androidSetupGuidance to that callback.

The IDA effects fixture added on main needs setupGuidance to satisfy the
widened AndroidAnalysisPort contract.
@morluto morluto added the area: domain Domain logic, errors, and pure functions label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants