[PR #7154] feat(mcp): advertise each tool's family in tools/list _meta #7679

Open
opened 2026-11-03 13:39:35 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7154
Author: @definitelynotchirag
Created: 10/25/2026
Status: 🔄 Open

Base: main ← Head: feat/tool-family-meta


📝 Commits (3)

  • cf110bc feat(mcp): advertise each tool's family in tools/list _meta
  • 3a325c2 refactor(mcp): advertise the selectable family id in tools/list _meta
  • d359c14 fix(mcp): omit family metadata for contracts outside the inventory

📊 Changes

6 files changed (+99 additions, -8 deletions)

View changed files

📝 docs/client-configuration.md (+10 -0)
📝 docs/mcp-contracts.md (+11 -0)
📝 src/contracts/toolContractTypes.ts (+14 -0)
📝 src/server/DeferredEvidenceMcpServer.test.ts (+4 -0)
📝 src/server/toolRegistrationOptions.ts (+22 -8)
➕ tests/boundary/mcp/toolFamilyMetaMcp.test.ts (+38 -0)

📄 Description

Summary

Fixes #6870. MCP clients and gateways that index a large catalog lazily had to guess which group each of REA's 233 tools belongs to from its name. One Harness plugin kept a hand-written mapping of 207 tools that goes stale on every tool addition. Every tools/list entry now includes its tool family in _meta.

Problem and expected behavior

On main, a tools/list entry exposes no family. The only place that reports it is tool_availability.groups.surface in binary_session, which needs a call with complete detail.

With this change each entry includes "_meta": {"io.github.morluto/rea": {"family": "native"}}. The value is the selectable family id from the inventory #7228 added, the same vocabulary REA_MCP_TOOL_FAMILIES and rea setup --tool-families accept, so a client can map any tool to the scope that enables it. The adapter kind (native-provider) is not advertised; it stays internal as the family's surface. No tool is hidden or renamed, and input schemas are unchanged.

Change and scope

toolRegistrationOptions is the one boundary that turns a contract into a registration for every REA tool. It now attaches _meta from toolFamilyId(contract.name). A contract outside the inventory, which only renamed test fixtures are, advertises no family rather than a guessed one. The key constant and the ToolFamilyMeta type sit in src/contracts/toolContractTypes.ts. The deferred server already replays recorded tool metadata unchanged, so the build-recorded catalog includes the field without a code change.

Not included: the issue's optional per-family description and family list, which tools.families in the product catalog already provides. The unprefixed result-level provenance key in _meta, which predates this change.

Contract and boundary impact

  • Semantic owner and earliest changed stage: TOOL_FAMILY_DEFINITIONS in src/contracts/toolFamilies.ts owns the fact and toolRegistrationOptions projects it at registration. No consumer reinterprets it.

  • Contribution scope fit and linked maintainer decision: discovery metadata only, not applicable.

  • CLI and MCP/tool-catalog contract: additive _meta on every tools/list entry. Catalog digests do not change. The field adds 10,195 bytes across 233 tools, 0.26% of the rebuilt dist/mcp-catalog.json and 0.23% of dist/mcp-catalog-full.json (relevant to #7155).

  • 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): not applicable.

  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: the build rewrites dist/mcp-catalog.json with the field. Nothing generated is committed.

  • 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: tests/boundary/mcp/toolFamilyMetaMcp.test.ts lists tools through the real server for the full and compact input profiles and checks every entry's family against the family inventory. src/server/DeferredEvidenceMcpServer.test.ts asserts that a recorded _meta reaches the client through the deferred server.
  • Base reproduction or other evidence: on main, tools/list entries have no _meta.
  • User-visible CLI/MCP output (if applicable): one entry from the rebuilt dist/mcp-catalog.json ends with "_meta":{"io.github.morluto/rea":{"family":"native"}}.
  • Remaining proof gaps: I checked the output-schema off profile and the deferred server's late materialization path by reading the code, not with a test.

Validation performed

  • npm run check:fast passed.
  • npm run test:focused -- tests/boundary/mcp/toolFamilyMetaMcp.test.ts tests/boundary/mcp/toolFamiliesMcp.test.ts src/server/DeferredEvidenceMcpServer.test.ts src/contracts/toolFamilies.test.ts passed after rebasing onto c0c390220 (28 tests).
  • npm run docs:check passed.
  • npm run mcp-catalog:check:built passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none, the field is additive.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none. No new inputs or effects.

Author readiness

Human owner: @definitelynotchirag

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/7154 **Author:** [@definitelynotchirag](https://github.com/definitelynotchirag) **Created:** 10/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/tool-family-meta` --- ### 📝 Commits (3) - [`cf110bc`](https://github.com/morluto/rea/commit/cf110bc186452f3f11cae7fd2027d4fd44413c87) feat(mcp): advertise each tool's family in tools/list _meta - [`3a325c2`](https://github.com/morluto/rea/commit/3a325c2a05e6a0e88611983e10714c6b3cf5e2f6) refactor(mcp): advertise the selectable family id in tools/list _meta - [`d359c14`](https://github.com/morluto/rea/commit/d359c14547dbe26a8b24d36936e628ac6cba2593) fix(mcp): omit family metadata for contracts outside the inventory ### 📊 Changes **6 files changed** (+99 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `docs/client-configuration.md` (+10 -0) 📝 `docs/mcp-contracts.md` (+11 -0) 📝 `src/contracts/toolContractTypes.ts` (+14 -0) 📝 `src/server/DeferredEvidenceMcpServer.test.ts` (+4 -0) 📝 `src/server/toolRegistrationOptions.ts` (+22 -8) ➕ `tests/boundary/mcp/toolFamilyMetaMcp.test.ts` (+38 -0) </details> ### 📄 Description ## Summary Fixes #6870. MCP clients and gateways that index a large catalog lazily had to guess which group each of REA's 233 tools belongs to from its name. One Harness plugin kept a hand-written mapping of 207 tools that goes stale on every tool addition. Every `tools/list` entry now includes its tool family in `_meta`. ## Problem and expected behavior On main, a `tools/list` entry exposes no family. The only place that reports it is `tool_availability.groups.surface` in `binary_session`, which needs a call with complete detail. With this change each entry includes `"_meta": {"io.github.morluto/rea": {"family": "native"}}`. The value is the selectable family id from the inventory #7228 added, the same vocabulary `REA_MCP_TOOL_FAMILIES` and `rea setup --tool-families` accept, so a client can map any tool to the scope that enables it. The adapter kind (`native-provider`) is not advertised; it stays internal as the family's `surface`. No tool is hidden or renamed, and input schemas are unchanged. ## Change and scope `toolRegistrationOptions` is the one boundary that turns a contract into a registration for every REA tool. It now attaches `_meta` from `toolFamilyId(contract.name)`. A contract outside the inventory, which only renamed test fixtures are, advertises no family rather than a guessed one. The key constant and the `ToolFamilyMeta` type sit in `src/contracts/toolContractTypes.ts`. The deferred server already replays recorded tool metadata unchanged, so the build-recorded catalog includes the field without a code change. Not included: the issue's optional per-family description and family list, which `tools.families` in the product catalog already provides. The unprefixed result-level `provenance` key in `_meta`, which predates this change. ## Contract and boundary impact - Semantic owner and earliest changed stage: `TOOL_FAMILY_DEFINITIONS` in `src/contracts/toolFamilies.ts` owns the fact and `toolRegistrationOptions` projects it at registration. No consumer reinterprets it. - Contribution scope fit and linked maintainer decision: discovery metadata only, not applicable. - CLI and MCP/tool-catalog contract: additive `_meta` on every `tools/list` entry. Catalog digests do not change. The field adds 10,195 bytes across 233 tools, 0.26% of the rebuilt `dist/mcp-catalog.json` and 0.23% of `dist/mcp-catalog-full.json` (relevant to #7155). - 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): not applicable. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: the build rewrites `dist/mcp-catalog.json` with the field. Nothing generated is committed. - [ ] 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. - [x] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: `tests/boundary/mcp/toolFamilyMetaMcp.test.ts` lists tools through the real server for the full and compact input profiles and checks every entry's family against the family inventory. `src/server/DeferredEvidenceMcpServer.test.ts` asserts that a recorded `_meta` reaches the client through the deferred server. - Base reproduction or other evidence: on main, `tools/list` entries have no `_meta`. - User-visible CLI/MCP output (if applicable): one entry from the rebuilt `dist/mcp-catalog.json` ends with `"_meta":{"io.github.morluto/rea":{"family":"native"}}`. - Remaining proof gaps: I checked the output-schema `off` profile and the deferred server's late materialization path by reading the code, not with a test. ## Validation performed - `npm run check:fast` passed. - `npm run test:focused -- tests/boundary/mcp/toolFamilyMetaMcp.test.ts tests/boundary/mcp/toolFamiliesMcp.test.ts src/server/DeferredEvidenceMcpServer.test.ts src/contracts/toolFamilies.test.ts` passed after rebasing onto `c0c390220` (28 tests). - `npm run docs:check` passed. - `npm run mcp-catalog:check:built` passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none, the field is additive. - Real Hopper/Ghidra, browser, or OS coverage: not applicable. - Package or release metadata impact: none. - Security, privacy, process, or containment review: none. No new inputs or effects. ## Author readiness Human owner: @definitelynotchirag - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7679
No description provided.