Skip to content

feat(mcp): scope advertised tools by family - #7228

Merged
gensokyo-dev merged 5 commits into
mainfrom
feat/3246-mcp-tool-families
Oct 26, 2026
Merged

gensokyo-dev merged 5 commits into
mainfrom
feat/3246-mcp-tool-families

Conversation

@gensokyo-dev

@gensokyo-dev gensokyo-dev commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #3246. Add opt-in REA_MCP_TOOL_FAMILIES=native,application,session and rea setup --tool-families so clients discover only relevant tools. Unset configuration retains the existing catalog. Builds on #3026 by @0xLLVEL; upstream authorship and assistance trailers are preserved.

Change and scope

The parsed family selection is retained in shared configuration; CLI capabilities/providers and MCP use one catalog-identity owner. One contract-owned family inventory drives registration, prompts, setup, doctor and catalog identity. Disabled tools reject direct calls; session status counts only advertised tools and skips unrelated optional-provider probes. Initialization/recovery guidance names only advertised tools; real stdio tests cover scopes that advertise no prompts (the SDK already normalizes absent prompt capability). All six input/output schema profiles and canonical response validation remain supported. Setup is additive, backed up and idempotent; invalid scope fails before writes.

Scope decision: not applicable; existing provider boundaries, no added target execution or mutation. CLI setup can write caller-selected configuration; analysis reads existing binaries. Evidence identity, coverage, limitations, retained paging and complete export remain intact. Include application for retained Evidence queries and analysis settings.

Evidence and validation

  • Source suites: 48 cases; targeted boundary suites: 74 cases across focused runs. Production doctor: 31 cases. Real setup CLI backup/idempotency/invalid-input acceptance passed.
  • Six CLI status boundary cases passed, including both scoped status commands. Eleven framing/guidance boundary cases passed. The CLI negative control reproduces both scoped-identity failures against the previous producer; the zero-prompts control passes on the previous SDK path, so no duplicate prompt-capability interpretation was added. Four scoped/invalid/empty-prompt production doctor cases passed, including both real CLI inventory commands.
  • Real stdio acceptance passed with full, compact and off output profiles, including scoped discovery/status and rejection of disabled tools.
  • npm run build:cached, npm run check:fast, npm run docs:check (9 checks), npm run format:check passed after rebasing onto e54bf1006.
  • Two existing live-identity tests initially exceeded their 30-second deadline; both passed in isolated reruns (21.4s/16.6s), and one clean-main control passed in 19.1s. Timing variability is unresolved; no timeout was relaxed. One combined verification run hit its outer 190-second guard after build/stdio/check passed; remaining docs/format passed separately.

Actual SDK workflow against system libcrypto.so.3: two discoveries, cold/warm export inspection, first/last retained pages, complete bundle export and offline verification. All four configurations returned the same 5,367 GNU-nm-verified names/addresses and identical full Evidence hash. Linux only; external deep providers were not required or verified by this feature.

Completed task Main, compact Selected families, compact Selected families, full Feature, scope unset
Tools 229 73 73 229
Catalog bytes 554,792 192,959 1,400,171 554,792
Input-schema tokens (estimate) 56,909 23,070 23,070 56,909
Two-discovery wire tokens (estimate) 240,494 88,881 716,419 240,494
Elapsed seconds 21.89 7.00 12.18 8.26
Process-family CPU seconds 12.16 6.56 12.23 7.59
Peak process-family GiB 0.596 0.560 1.037 0.594

Single sequential samples on a shared host; the unset control also varies substantially, so these do not establish a general speedup. Tokens use cl100k_base, not measured model usage. Each completed workflow includes cold/warm calls and cleanup; 2-CPU affinity, 8-GiB guard, no OOM. Reproduction, exact revisions, retained identities and measurement limitations: experiment.

CI attribution and authorized bypass

Final head 03cb8a110, CI run 40315595135: static checks, source tests, package build, docs, Windows capability/package checks, native package baselines and Greptile passed. Test shards 2 and 3 passed. Shard 8 failed one WorkBuddy path assertion; five other shards were cancelled, with four additional assertions found in their logs. Those cancelled shards do not establish complete coverage.

Exact clean-main e54bf1006 and feature controls reproduce all five built-suite assertions with identical failed-case names and diagnostics: WorkBuddy/Trae personal skill paths, redirected-AppData Claude Desktop uninstall, pwntools completed-read cleanup, and pcap ENOTDIR allocation. Related producers/tests are unchanged. Node 22.23.4 separately reproduces the same five SQLite descriptor-cleanup failures on both revisions (16 pass); Node 24 and 26 SQLite CI passes. Aggregate Portable tests/CI required failures derive from these results.

All reported assertion failures are attributed; no unclassified assertion failures remain in downloaded failed/cancelled logs. Unexecuted/cancelled coverage remains unverified. The user explicitly authorized bypass for demonstrated baseline failures and the unchecked human-readiness gate; no human review is attested.

Author readiness

Human owner: @gensokyo-dev

  • 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.

These declarations remain unchecked; the user explicitly authorized opening ready for review and bypassing this gate without an AI attestation of human review.

llevel and others added 3 commits October 26, 2026 10:50
Integrate #3026 onto current main, preserving full/compact/off output profiles,
summary/complete session semantics and main parsed registration ownership.
Use one family inventory for runtime and product metadata, including current
analysis-setting and environment contracts. Gate optional provider probes and
verify named SDK scope, canonical availability and invalid-scope recovery.

Co-authored-by: Codebuff <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 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 ✅ Completed 2026-10-26T11:33:06.168126Z 03cb8a1 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc71669d7f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/application/DirectAnalysisStatus.ts Resolved
@greptile-apps

greptile-apps Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge; no blocking finding remains.

Summary

Adds opt-in tool-family selection across MCP discovery, status, prompts, catalog identity, and setup.

  • MCP clients can discover only the tool families their workflow needs.
  • Status and catalog identity now match the tools a registration advertises.
  • Prompts and server guidance now avoid tools outside the selected scope.
  • Setup can save a tool-family scope in an MCP client registration.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Selection[Selected tool families] --> Inventory[Shared family inventory]
  Inventory --> Tools[Advertised tools]
  Inventory --> Prompts[Available prompts]
  Inventory --> Identity[Catalog identity]
  Inventory --> Guidance[Scope-aware recovery advice]
  Tools --> Doctor[Doctor checks]
  Prompts --> Doctor
  Identity --> Doctor
Loading

Reviews (3) · Last reviewed commit: "fix(mcp): align recovery guidance with a..." · Reviewed by Greptile

Comment thread src/server/createServer.ts Resolved
Comment thread tests/boundary/mcp/mcpDoctor.test.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5e05edf45

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/server/createServer.ts Resolved
@gensokyo-dev
gensokyo-dev merged commit b675073 into main Oct 26, 2026
35 of 48 checks passed
@gensokyo-dev
gensokyo-dev deleted the feat/3246-mcp-tool-families branch October 26, 2026 11:50
@github-actions github-actions Bot mentioned this pull request Oct 26, 2026
3 tasks done
definitelynotchirag added a commit to definitelynotchirag/rea that referenced this pull request Oct 29, 2026
Since morluto#7228 the contract-owned family inventory gives every tool one
selectable id, the vocabulary REA_MCP_TOOL_FAMILIES accepts. Advertise
that id instead of the adapter kind so clients can map an advertised tool
back to the scope that enables it.
@morluto morluto added area: mcp MCP server, transport, and tool registration enhancement New feature or request labels Nov 23, 2026
vincentkoc added a commit that referenced this pull request Nov 30, 2026
* feat(mcp): advertise each tool's family in tools/list _meta

Clients that index a large catalog lazily had to guess each REA tool's
group from its name. Every tools/list entry now carries the contract's
adapter family under the vendor-prefixed _meta key
"io.github.morluto/rea", attached once at the contract-to-registration
boundary. The recorded catalog replays it unchanged on the deferred path.

No tool is hidden or renamed and input schemas are unchanged.

Closes #6870

* refactor(mcp): advertise the selectable family id in tools/list _meta

Since #7228 the contract-owned family inventory gives every tool one
selectable id, the vocabulary REA_MCP_TOOL_FAMILIES accepts. Advertise
that id instead of the adapter kind so clients can map an advertised tool
back to the scope that enables it.

* fix(mcp): omit family metadata for contracts outside the inventory

Renamed test fixtures have no published family; advertise nothing for
them instead of throwing. Drop the docs claim that a family move changes
the catalog digest, since the digest hashes the adapter kind.

* docs(mcp): scope family _meta promise to domain tools; pin catalog env in test

---------

Co-authored-by: Vincent Koc <[email protected]>
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 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Scope advertised MCP tools by family through REA_MCP_TOOL_FAMILIES

3 participants