[PR #294] [MERGED] fix(contracts): make agent-facing schemas self-describing #1930

Closed
opened 2026-10-16 21:12:36 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/294
Author: @morluto
Created: 7/17/2026
Status: ✅ Merged
Merged: 7/17/2026
Merged by: @morluto

Base: main ← Head: codex/agent-tool-guidance


📝 Commits (3)

  • 1581e40 fix(mcp): clarify advertised schema fields
  • ad17fe7 docs: prioritize agent usability in tool design
  • d4be3e7 docs(cli): describe every command input

📊 Changes

15 files changed (+983 additions, -310 deletions)

View changed files

📝 AGENTS.md (+3 -1)
📝 docs/api/functions/server_toolRegistrationOptions.closeObjectSchemas.html (+1 -1)
📝 scripts/lib/product-catalog.d.mts (+1 -0)
📝 scripts/lib/product-catalog.mjs (+25 -0)
📝 src/cli.ts (+281 -124)
📝 src/cliBrowserAdvancedCommands.ts (+75 -16)
📝 src/cliBrowserCommands.ts (+177 -112)
📝 src/cliElectronCommands.ts (+162 -32)
📝 src/cliEvidenceCommands.ts (+13 -2)
📝 src/cliInvestigationCommands.ts (+53 -10)
📝 src/cliPolicyCommands.ts (+32 -9)
📝 src/server/toolRegistrationOptions.ts (+118 -3)
📝 tests/contractSnapshot.test.ts (+26 -0)
📝 tests/integration/serverIntegration.test.ts (+11 -0)
📝 tests/productCatalog.test.ts (+5 -0)

📄 Description

Description

REA's MCP catalog and CLI help exposed valid field shapes, but some generated properties lacked enough semantic guidance for an agent to choose and populate them correctly. The CLI router had 206 undocumented arguments and options, and closed MCP schemas could advertise nested or output-root properties without descriptions.

This change:

  • adds operation-specific descriptions to every CLI argument and option across all 55 primary commands;
  • adds semantic fallback descriptions when the MCP schema-closing pass encounters an otherwise undocumented field;
  • describes every advertised output-schema root property;
  • adds catalog invariants that fail when CLI fields or MCP output roots lose their descriptions;
  • records the design rule that tool usability must be evaluated from a named client's actual model-facing projection, not serialized byte counts.

The MCP inventory remains at 95 tools. Field types, defaults, requiredness, tool names, and handler behavior are unchanged.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Performance improvement
  • Refactoring (no functional change)
  • Tool contract change (MCP schema modification)

Testing Performed

  • Unit tests added or updated
  • TypeScript typecheck passes (npm run typecheck)
  • Linting passes (npm run lint)
  • Full test suite passes (npm test)
  • Real Hopper verification performed (npm run verify:hopper)
  • Linux real Hopper verification performed (npm run verify:hopper:linux) or unavailability explained
  • Real browser verification performed (npm run verify:browser) or unavailability explained
  • Package verification performed (npm run verify:package)

Additional validation:

  • npm run check
  • npm pack --dry-run

Tool Contract Impact

All 95 MCP tools retain their existing names and schemas. The advertised JSON Schemas gain missing property descriptions only. CLI command schemas likewise retain their accepted values while producing complete help metadata.

No directly related issue was found.


🔄 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/294 **Author:** [@morluto](https://github.com/morluto) **Created:** 7/17/2026 **Status:** ✅ Merged **Merged:** 7/17/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `codex/agent-tool-guidance` --- ### 📝 Commits (3) - [`1581e40`](https://github.com/morluto/rea/commit/1581e40fce733c19e11b460b47722e4121e9fd0e) fix(mcp): clarify advertised schema fields - [`ad17fe7`](https://github.com/morluto/rea/commit/ad17fe7aa71f5cbffcdff3e27b08bc4538e73c7d) docs: prioritize agent usability in tool design - [`d4be3e7`](https://github.com/morluto/rea/commit/d4be3e7f9a609050303c82aa83d4884bb6daae77) docs(cli): describe every command input ### 📊 Changes **15 files changed** (+983 additions, -310 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+3 -1) 📝 `docs/api/functions/server_toolRegistrationOptions.closeObjectSchemas.html` (+1 -1) 📝 `scripts/lib/product-catalog.d.mts` (+1 -0) 📝 `scripts/lib/product-catalog.mjs` (+25 -0) 📝 `src/cli.ts` (+281 -124) 📝 `src/cliBrowserAdvancedCommands.ts` (+75 -16) 📝 `src/cliBrowserCommands.ts` (+177 -112) 📝 `src/cliElectronCommands.ts` (+162 -32) 📝 `src/cliEvidenceCommands.ts` (+13 -2) 📝 `src/cliInvestigationCommands.ts` (+53 -10) 📝 `src/cliPolicyCommands.ts` (+32 -9) 📝 `src/server/toolRegistrationOptions.ts` (+118 -3) 📝 `tests/contractSnapshot.test.ts` (+26 -0) 📝 `tests/integration/serverIntegration.test.ts` (+11 -0) 📝 `tests/productCatalog.test.ts` (+5 -0) </details> ### 📄 Description ## Description REA's MCP catalog and CLI help exposed valid field shapes, but some generated properties lacked enough semantic guidance for an agent to choose and populate them correctly. The CLI router had 206 undocumented arguments and options, and closed MCP schemas could advertise nested or output-root properties without descriptions. This change: - adds operation-specific descriptions to every CLI argument and option across all 55 primary commands; - adds semantic fallback descriptions when the MCP schema-closing pass encounters an otherwise undocumented field; - describes every advertised output-schema root property; - adds catalog invariants that fail when CLI fields or MCP output roots lose their descriptions; - records the design rule that tool usability must be evaluated from a named client's actual model-facing projection, not serialized byte counts. The MCP inventory remains at 95 tools. Field types, defaults, requiredness, tool names, and handler behavior are unchanged. ## Type of Change - [x] Bug fix - [ ] New feature - [x] Documentation update - [ ] Performance improvement - [x] Refactoring (no functional change) - [x] Tool contract change (MCP schema modification) ## Testing Performed - [x] Unit tests added or updated - [x] TypeScript typecheck passes (`npm run typecheck`) - [x] Linting passes (`npm run lint`) - [x] Full test suite passes (`npm test`) - [ ] Real Hopper verification performed (`npm run verify:hopper`) - [ ] Linux real Hopper verification performed (`npm run verify:hopper:linux`) or unavailability explained - [ ] Real browser verification performed (`npm run verify:browser`) or unavailability explained - [x] Package verification performed (`npm run verify:package`) Additional validation: - `npm run check` - `npm pack --dry-run` ## Tool Contract Impact All 95 MCP tools retain their existing names and schemas. The advertised JSON Schemas gain missing property descriptions only. CLI command schemas likewise retain their accepted values while producing complete help metadata. ## Related Issues No directly related issue was found. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:12:36 +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#1930
No description provided.