[PR #1705] [MERGED] fix(mcp): express inspect_analysis_view selector constraints in the contract schema #4766

Closed
opened 2026-10-31 00:54:50 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1705
Author: @sx4im
Created: 10/11/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @morluto

Base: main ← Head: fix/inspect-analysis-view-selector-schema


📝 Commits (1)

  • e1dbe0f fix(mcp): express inspect_analysis_view selector constraints in the contract schema

📊 Changes

2 files changed (+124 additions, -37 deletions)

View changed files

📝 src/domain/analysisView/analysisView.ts (+35 -37)
📝 tests/boundary/mcp/toolSchemaValidity.test.ts (+89 -0)

📄 Description

Fixes #1695.

The item view of inspect_analysis_view declared its four selector alternatives independently of the selected collection, and only a superRefine enforced which selectors each collection accepts. Refinements don't survive JSON Schema conversion, so the draft-2020-12 schema advertised on tools/list accepted combinations the MCP server rejects: modules with index/name, sections with path, symbols with node_id.

This moves the collection/selector alternatives into the contract itself: a discriminated union on collection where modules takes path/node_id and sections/symbols take index/name. Runtime behavior is unchanged; the same inputs are rejected and accepted as before. A mismatched selector now surfaces as selector-level union issues (e.g. view.selector.index flagged as an unknown argument) instead of the old custom refinement message.

Verification:

  • New boundary test registers the tool the same way the MCP server does, reads the advertised schema back from tools/list, and asserts all four invalid combinations are rejected by both the runtime schema and the advertised JSON Schema while the six valid ones are accepted by both. It failed before the fix (the advertised schema accepted modules+index) and passes now.
  • npm run check:fast (typecheck, lint) and npm run verify:test-discovery are green.
  • Surrounding suites all green: domain analysis view tests (17), MCP boundary tests for this tool (8), CLI boundary tests (7), service tests (11), contract schema reference tests (9).

🔄 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/1705 **Author:** [@sx4im](https://github.com/sx4im) **Created:** 10/11/2026 **Status:** ✅ Merged **Merged:** 10/11/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/inspect-analysis-view-selector-schema` --- ### 📝 Commits (1) - [`e1dbe0f`](https://github.com/morluto/rea/commit/e1dbe0f02f91e931a1b060e10bdb75e940d7f620) fix(mcp): express inspect_analysis_view selector constraints in the contract schema ### 📊 Changes **2 files changed** (+124 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/analysisView/analysisView.ts` (+35 -37) 📝 `tests/boundary/mcp/toolSchemaValidity.test.ts` (+89 -0) </details> ### 📄 Description Fixes #1695. The item view of `inspect_analysis_view` declared its four selector alternatives independently of the selected collection, and only a `superRefine` enforced which selectors each collection accepts. Refinements don't survive JSON Schema conversion, so the draft-2020-12 schema advertised on `tools/list` accepted combinations the MCP server rejects: `modules` with `index`/`name`, `sections` with `path`, `symbols` with `node_id`. This moves the collection/selector alternatives into the contract itself: a discriminated union on `collection` where `modules` takes `path`/`node_id` and `sections`/`symbols` take `index`/`name`. Runtime behavior is unchanged; the same inputs are rejected and accepted as before. A mismatched selector now surfaces as selector-level union issues (e.g. `view.selector.index` flagged as an unknown argument) instead of the old custom refinement message. Verification: - New boundary test registers the tool the same way the MCP server does, reads the advertised schema back from `tools/list`, and asserts all four invalid combinations are rejected by both the runtime schema and the advertised JSON Schema while the six valid ones are accepted by both. It failed before the fix (the advertised schema accepted `modules`+`index`) and passes now. - `npm run check:fast` (typecheck, lint) and `npm run verify:test-discovery` are green. - Surrounding suites all green: domain analysis view tests (17), MCP boundary tests for this tool (8), CLI boundary tests (7), service tests (11), contract schema reference tests (9). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:54:50 +00:00
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#4766
No description provided.