Skip to content

feat(mcp): accept common argument-name aliases for procedure and search tools - #2148

Closed
pablodiazjorge wants to merge 28 commits into
morluto:mainfrom
pablodiazjorge:feat/mcp-input-key-aliases
Closed

pablodiazjorge wants to merge 28 commits into
morluto:mainfrom
pablodiazjorge:feat/mcp-input-key-aliases

Conversation

@pablodiazjorge

@pablodiazjorge pablodiazjorge commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #2146.

Agents carry argument names from one tool to the next. After resolve_containing_procedure, xrefs or read_bytes, which take address, they send address to procedure-scoped tools that take procedure; and they send query to the search tools, which take pattern. Strict input validation rejects these calls before they reach REA. In the study described in the issue (40 runs, 321 REA calls) this caused 18 input validation failures in 10 runs, and the agent recovered in 9 of them.

The two later studies in rea-lab, with the same pinned REA 6.4.0, saw the same mistake: in study 2, 7 of the 9 MCP input validation errors sent address or query, and 6 of those went to tools this PR covers (the seventh was list_strings, which takes no filter); in study 3, both of them were procedure_pseudo_code with address.

This PR makes the named tool contracts accept those two spellings, advertise them, and parse them into the canonical key before the handler runs. The current implementation is @morluto's rework of the first version (see Change and scope).

Problem and expected behavior

Before: search_strings {"query": "ACCESS"} returns Input validation error: Invalid arguments for tool search_strings: pattern: Invalid input: expected string, received undefined, Unrecognized key: "query".

After: the call is parsed as {"pattern": "ACCESS"}, and the handler and the recorded Evidence parameters see only pattern. The same applies to address on tools whose input declares procedure.

Unchanged:

  • An input that sends both spellings is rejected, now with Supply either pattern or query, not both (or procedure or address).
  • Unknown keys, including misspellings, are still rejected.
  • Canonical value checks, defaults and cross-field refinements apply to either spelling.

Change and scope

  • src/contracts/inputKeyAliases.ts holds a fixed list of two pairs, address for procedure and query for pattern, and compatibleToolInputSchema wraps a named contract's input: it accepts strict alternatives with either spelling, rejects both together, and parses into the canonical key. A pair applies only when the input declares the canonical key and not the alias. On the current head that is:
    • address (12 tools): analyze_function, annotate_native_function, inspect_native_api, procedure_address, procedure_assembly, procedure_callees, procedure_callers, procedure_info, procedure_pseudo_code, procedure_references, read_function_instructions, trace_native_values. In all of them procedure takes a procedure name or address.
    • query (5 tools): analyze_swift_types, get_objc_classes, search_procedures, search_strings, and search_bytes. In the first four pattern is a name or text filter. search_bytes reached main in feat(native): search analyzed memory for masked byte patterns #2341 after this PR was opened, and there pattern is a masked byte pattern such as 48 8B ?? ?? 89; query gets exactly the same validation, so text sent as query is rejected with the byte-pattern format error rather than reinterpreted. If you would rather keep query to text filters, excluding search_bytes is a one-line change.
  • The enhanced, function-workflow and official tool contracts build their input with compatibleToolInputSchema, so one contract owns both spellings and the canonical parsed output. The MCP server no longer rewrites raw caller arguments.
  • Advertised input schemas are one strict object that accepts exactly the alternatives: the properties of both spellings with additionalProperties: false, the keys every alternative requires, and a not rule that rejects both spellings (and requires one when the selector is required), in the full and compact profiles. An alias property is described as Same as <canonical>. (for example Same as procedure.) rather than with a copy of the canonical description.
  • docs/mcp-contracts.md documents this in a new "Compatible input spellings" subsection.

Catalog budget: the aliases as first advertised cost 7,104 bytes across the 17 tools, mostly text repeated in every tool: a selector sentence, the shared root-union presentation's input-group sentence and minProperties, and alias properties that copied their canonical description. That took the full input catalog with output schemas omitted 1,373 bytes over the 1 MiB frame that outputSchemaProfile.test.ts enforced then. 7b6b903, 918a144 and dd000cb remove the repetition: the projection advertises the one strict object above instead of root alternatives, so the shared presentation adds nothing. #7379 has since removed that frame for full input. With main at 65f1c4473, the aliases cost 2,734 bytes in the full input catalog with output schemas omitted (908,170 bytes on Linux, 905,436 without them) and 2,136 bytes in the default compact catalog (568,933 bytes on Linux). I kept the flat object because it costs 2,734 bytes where the alternatives cost 5,082 for the same accepted set. It departs from the earlier comment that kept the exact alternatives in the projection for schema consumers; the unit and MCP tests check the accepted set with Ajv. If you would rather go back to the alternatives now that the frame is gone, that is your call.

The first version of this PR renamed aliases inside EvidenceMcpServer.registerTool and kept advertised schemas canonical-only. @morluto moved ownership into the named contracts and advertised the alternatives (4d06d3c, 25e93ae, 12a989a, 52d2a2d); 663ea6f types the compatible schemas under exactOptionalPropertyTypes.

Not included:

  • No fuzzy matching of arbitrary keys.
  • No renaming of existing parameters.
  • No change to CLI argument parsing.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the named tool input contracts (src/contracts/inputKeyAliases.ts and the contract builders that use it).
  • CLI and MCP/tool-catalog contract: MCP calls with only address (on the 12 tools above) or only query (on the 5 tools above) now validate, and tools/list advertises both spellings for those tools. The CLI is unchanged.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none. Recorded parameters use the canonical key, so Evidence identity does not depend on which spelling the agent sent.
  • Process execution, authorization, cleanup, or containment impact: none. annotate_native_function is among the 12 tools; the alias only names its target procedure and does not change its mutation authority.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none; productCatalog.test.ts passes on this head.

Evidence and regression coverage

  • Tests added or updated:

    • src/contracts/inputKeyAliases.test.ts (8 tests): which inputs get aliases, caller values preserved, both spellings advertised as one strict object and parsed while ambiguity, a missing selector and unknown keys are rejected, alias properties described by their canonical spelling, canonical checks and refinements retained, optional selectors accepted with either spelling or neither but not both, transforms parsed once, and contracts without compatible keys left unwrapped.
    • tests/boundary/mcp/inputKeyAliasesMcp.test.ts (9 tests): the full tool catalog on EvidenceMcpServer over an in-memory MCP client, with and without the compact profile: aliases accepted, alias values validated before dispatch, both spellings rejected, accepted aliases advertised through SDK conversion (checked with Ajv), alias descriptions that name the canonical spelling instead of a key-based fallback in the full profile, and canonical parameters recorded in Evidence after an alias call.
  • Base reproduction or other evidence: on main, search_strings {"query"} and procedure_pseudo_code {"address"} fail with Unrecognized key. @CassieFox23 verified head 46ad54d on Linux over stdio MCP (comment).

  • User-visible CLI/MCP output, from the built server over stdio on Windows, head e171684, identical with the default compact profile and with REA_MCP_INPUT_SCHEMA_PROFILE=full (no binary open, so a call that passes validation returns target_unavailable; a rejected call returns invalid_request, and the table quotes its details.issues[].message):

    Call Result
    search_strings {"query": "ACCESS"} reaches the tool
    procedure_pseudo_code {"address": "0x401000"} reaches the tool
    search_bytes {"query": "48 8B ?? ?? 89"} reaches the tool
    search_bytes {"query": "ACCESS"} pattern: Use hexadecimal byte pairs or ?? wildcards, the same as {"pattern": "ACCESS"}
    search_strings {"query": "a", "pattern": "b"} Supply either pattern or query, not both
    procedure_pseudo_code {"adress": "0x401000"} procedure: Invalid input: expected string, received undefined, Unrecognized key: "adress"
  • Remaining proof gaps: no real-provider session was run with the change; validation happens before any provider call.

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

Windows 11 x64 (10.0.26300), Node 24.22.1, head e171684 (this branch updated with main at the 6.8.0 release, 160d821), with the Windows native controls from the published [email protected] package:

  • npx vitest run src/contracts tests/boundary/mcp/inputKeyAliasesMcp.test.ts: 215 passed.
  • npm run build, npm run test:prepare, npm run check and npm run docs:check: passed; then npx vitest run tests/boundary/filesystem/productCatalog.test.ts: 10 passed.
  • npx vitest run src/contracts src/server src/config tests/boundary/mcp: 1867 passed, 23 failed, 96 skipped. The same 23 tests, in 18 files outside this change, fail on main at 160d821 on this host with the same native controls, so the change adds no failure.
  • The stdio calls in the table above, with REA_MCP_INPUT_SCHEMA_PROFILE unset (compact, the default since 6.8.0) and set to full.
  • After merging main at ff6d96bce (head 66dde5165; one import conflict in src/contracts/enhancedToolContracts.ts, both imports kept): tsc, src/contracts plus the alias and analysis-detail boundary tests (249 passed), the catalog tests (54 passed), npm run check and npm run docs:check passed.
  • On dd000cbca: npm run build, npm run test:prepare, npm run check and npm run docs:check passed. src/contracts, src/server and the alias, compact-schema, schema-validity, contract-presentation, doctor, output-schema-profile, v-mode and catalog tests: 462 passed and 1 failed, advertisedPatternsVMode.test.ts, which fails the same way on main on Windows ([Bug] Windows hosts advertise an absolute-path pattern that fails v-mode compilation #7151). outputSchemaProfile.test.ts passes on Windows (1,046,979 bytes); with process.platform reported as linux while the modules load, it measures 1,045,579 bytes (1,049,949 on 66dde5165, matching CI). npx vitest run src/contracts src/server src/config tests/boundary/mcp: 2,007 tests, with the same 23 failures as the run on e1716846d above and no new ones.
  • After merging main at 235e8bc05 (4c4069178; one import conflict in src/contracts/functionWorkflowToolContracts.ts, both imports kept; npm ci for zod 4.6.6) and at 65f1c4473 (7dbfd6b54, no conflicts): npm run build, npm run test:prepare, npm run docs:check, typecheck, lint, format, knip, architecture guards, knip:production and lint:typed passed. The alias, output-schema-profile and v-mode tests, plus the four files that failed CI on 4c4069178 and were fixed on main by fix(windows): restore native verification fixture coverage #7479 and fix(ci): align static checks and regression fixtures with current contracts #7349 (WindowsNativeLoader, safeOutputTreeCloseFailures, electronMcp, providerBinding): 58 passed. npx vitest run src/contracts src/server src/config tests/boundary/mcp: 2,015 passed and 22 failed, all among the 25 that fail on clean main at 235e8bc05 on this host (symlinks, Unix sockets and a file name with a tab), none new.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Every previously valid call keeps its result.
  • Real Hopper/Ghidra, browser, or OS coverage: none needed for validation, which runs before any provider call; checked on Windows here and on Linux by @CassieFox23.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: the alias list is fixed and small, and both spellings together are rejected, so validation never chooses between two values.

Author readiness

Human owner: @pablodiazjorge

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

Review checklist

  • This PR addresses a concrete problem or an agreed enhancement.
  • 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 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-27T17:36:41.749909Z
We couldn’t complete this review. Comment @codex review to try again.
7dbfd6b 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.

…ch tools

Agents send address to procedure-scoped tools and query to search tools. Canonical validation now renames these aliases to procedure and pattern when only the alias is present, so handlers and recorded Evidence parameters see the canonical key. Inputs with both keys are still rejected, and advertised schemas list only canonical keys.
@pablodiazjorge
pablodiazjorge force-pushed the feat/mcp-input-key-aliases branch from e057def to 06b761a Compare October 12, 2026 18:16
@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.

Copy link
Copy Markdown
Contributor

Thanks, @pablodiazjorge, for the focused alias implementation in #2148. I prepared one additional regression on top of 06b761a54d462094d5a8da57a83392c8fc5f942e: the test commit.

It checks that canonical and aliased procedure_pseudo_code calls reach the same normalized provider input, Evidence records procedure rather than address, and the target, provider, analysis profile, and result fields are preserved.

Formatting, the focused contract and MCP tests (2 files, 9 tests), typecheck, and git diff --check pass. Against the PR base, the new test fails because address is rejected and procedure is missing. The test uses an in-memory provider fixture; I did not run real Ghidra.

This covers Evidence parameter normalization for the current alias implementation. It does not take a position on the unresolved discussion in #2146 about accepting aliases versus strict validation with clearer remediation. If useful, this commit is ready to cherry-pick into your existing PR.

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

@pablodiazjorge

Copy link
Copy Markdown
Contributor Author

Thanks @jaelliot, that's a useful check to pin down. I cherry-picked your commit into the branch, keeping your authorship. On Windows 11 the new test passes with the existing alias tests (5/5) and the file is formatted. On the aliases-versus-strict-validation question in morluto/rea#2146: if @morluto prefers it, I'm happy to switch to option 2, a validation error that names the canonical key.

@pablodiazjorge

Copy link
Copy Markdown
Contributor Author

CI note: the only failing test is unrelated to this change. tests/boundary/mcp/serverIdentity.test.ts › "advertises active-target tools only when a matching target is open" timed out at 10 s on shard 2/6. The new commit only adds a test to inputKeyAliasesMcp.test.ts, the same suite was green on 06b761a54, and locally the test passes in 2.5 s on f9620ac86. Could a maintainer re-run the failed jobs when convenient?

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issue was found.

Summary

The PR adds address and query aliases to named tool contracts. Handlers and Evidence receive the canonical keys.

  • Procedure and search tools accept the argument names agents already carry.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["MCP arguments"] --> B["Named input contract"]
  B --> C{"Both spellings supplied?"}
  C -->|Yes| D["Reject call"]
  C -->|No| E["Rename alias to canonical key"]
  E --> F["Apply original checks and defaults"]
  F --> G["Handler and Evidence"]
Loading

Reviews (24) · Last reviewed commit: "Merge upstream/main into feat/mcp-input-..." · Reviewed by Greptile

Source-reviewed changes. Tests, builds and check reruns were skipped at maintainer request.

@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: 00a0711424

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/contracts/inputKeyAliases.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: 4d06d3c0a0

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/contracts/inputKeyAliases.ts Resolved
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open.

  1. thread 1

The MCP adapter previously accepted hidden spellings while the named schemas advertised canonical inputs only. Commit 4d06d3c moves compatibility to the named official/enhanced/function contracts: one parser renames caller keys without mutating their values, applies canonical validation exactly once, and explicitly rejects requests containing both spellings. Its input projection advertises the accepted object alternatives; the existing shared presentation still owns client-compatible root flattening and compact presentation. The adapter rewrite and obsolete canonical-only tests were removed. Owner regressions cover values, defaults, refinements, single execution of field transforms, ambiguity and advertised validation; SDK tools/list/Ajv and real MCP-call coverage was updated. Actual SDK/client schema conversion remains unverified because execution was disabled.

Source and affected-consumer inspection, targeted formatting with two threads, and git diff --check completed. Regression coverage was authored; tests, builds, typechecks, lint, provider execution and CI reruns were skipped at the user’s request.

@morluto morluto added enhancement New feature or request area: mcp MCP server, transport, and tool registration area: server Server layer and tool wiring P2: medium Medium priority issue labels Oct 13, 2026
@pablodiazjorge

Copy link
Copy Markdown
Contributor Author

Thanks @morluto. I ran what was skipped on 4d06d3c0a, on Windows 11 with Node 24.18.0:

  • npm run build:cached and the typecheck fail at the early return for contracts without aliases: src/contracts/inputKeyAliases.ts(46,42): error TS2375: Type 'Schema' is not assignable to type 'ZodType<output<Schema>, unknown, $ZodTypeInternals<output<Schema>, unknown>>' with 'exactOptionalPropertyTypes: true'. A direct as z.ZodType<z.output<Schema>> is rejected (TS2352); as unknown as z.ZodType<z.output<Schema>> compiles. I only used that locally to run the rest, so you may prefer different typing.
  • With that local change, npm run check:fast passes, and src/contracts/inputKeyAliases.test.ts plus tests/boundary/mcp/inputKeyAliasesMcp.test.ts pass 14/14. The full mcp-boundary project gives 481 passed and 16 skipped; its 2 failures (contractPresentation, toolSchemaValidity) came from a stale local .cache/mcp-tool-catalog.json and pass after npm run test:prepare.
  • Real MCP through the SDK, with Ghidra 12.1.4 on WinHelloCPP.exe: procedure_pseudo_code with {procedure: "entry"} and with {address: "entry"} return the same pseudocode, and both record parameters: {procedure: "entry"}. {procedure, address} is rejected with "Supply either procedure or address, not both", and {} is rejected at call time. search_strings with query matches pattern and records the canonical parameters.
  • In tools/list, as Codex noted, the flattened roots of procedure_pseudo_code and search_strings advertise no required and minProperties: 1, so a host validating against the advertised schema would accept {document: "x"}; the server still rejects it at call time.

@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: 25e93ae214

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/contracts/inputKeyAliases.ts Resolved
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open.

review thread

The alias schema projection now preserves a required selector constraint after the shared MCP presentation flattens the root union: missing canonical/alias selectors and requests containing both spellings are excluded independently of optional/defaulted fields. This is owned by the named alias contract and is covered by advertised-schema and MCP-call regression cases. The fix is live at 25e93ae. Source/consumer inspection and git diff --check passed; tests, builds, typechecks, lint, provider execution and CI reruns were skipped per instruction. No related cleanup remains.

@pablodiazjorge

Copy link
Copy Markdown
Contributor Author

The TS2375 at src/contracts/inputKeyAliases.ts:46 from my previous comment is still there in 25e93ae21 (I re-ran tsc --noEmit on it locally), and CI's Build package now fails at its npm run test:prepare step. The one-line cast from that comment (as unknown as z.ZodType<z.output<Schema>>) fixes the build; everything else I ran passed with it.

@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: 52d2a2d37b

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/contracts/inputKeyAliases.ts Resolved
@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: Fixed. The PR text now matches the code on both points I reported. On head 90f7011, search_bytes rejects text such as "ACCESS" as query, with the format error. My earlier head was 46ad54d.

This follows my earlier result on head 46ad54d. Head is now 90f7011, a merge of main. Its base is main 034342b. The server now reports 6.5.0. Thanks, pablodiazjorge, for updating the PR text and for the search_bytes check.

Check Node 22.23.1 Node 24.18.0 Node 26.11.1
PR test files, 15 tests pass pass pass
Product catalog test (10 tests) not run pass not run

The same counts as my earlier result. I drove the real stdio server again, with no binary open, in the full and compact profiles. Both gave the same answers. A call that gets past validation returns "No app is open". That error is the pass signal.

Call Result on head 90f7011
search_strings {"query"} and procedure_pseudo_code {"address"} reach the tool
search_strings with query and pattern rejected: "Supply either pattern or query, not both"
procedure_pseudo_code with procedure and address rejected: "Supply either procedure or address, not both"
Misspelled key, empty input, and address as a number rejected
resolve_containing_procedure {"procedure"} still rejected
search_bytes {"query": "48 8B ?? ?? 89"} reaches the tool
search_bytes {"query": "ACCESS"} rejected: use hexadecimal byte pairs or ?? wildcards
search_bytes {"pattern": "ACCESS"} rejected with the same message
search_bytes with query and pattern together rejected: "Supply either pattern or query, not both"

Advertised schemas. I checked tools/list with Ajv again. {"query":"x"} is accepted, and {"pattern":"x","query":"x"}, {} and {"document":"x"} are rejected. The full and compact profiles agree. The query key is listed on 5 tools and address on 12, out of 207 tools.

The two PR text points. The body now says tools/list advertises both spellings with a not rule. It says query applies to five tools, with search_bytes named as the fifth. I read the body and matched it to the counts above.

Not run

  • A real provider session or Ghidra.
  • Windows and macOS. The author says the search_bytes check ran on Windows.
  • The full mcp-boundary project, and the CI shards.
  • Head merged onto today's main 9d6651e.
  • The PR's two test files on main.
  • Whether search_bytes should take query at all. The author left that note for the maintainer.

The box was shared with other test jobs. Timings are not benchmarks.

Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.9
  • CPU: AMD Ryzen 9 5900X, 12 cores / 24 threads
  • RAM: 32 GB DDR4-3600
  • Node: 22.23.1, 24.18.0, 26.11.1
  • Head: 90f7011
  • Base: 034342b (main)
  • Other: stdio server started with rea.mjs mcp and a throwaway home folder; Ajv 2020 from the repo's own install
Commands
npm ci && npm run build && npm run test:prepare
node scripts/run-development-tests.mjs focused src/contracts/inputKeyAliases.test.ts tests/boundary/mcp/inputKeyAliasesMcp.test.ts
node scripts/run-development-tests.mjs focused tests/boundary/filesystem/productCatalog.test.ts
node scripts/rea.mjs mcp          # driven over stdio: initialize, tools/list, tools/call
REA_MCP_INPUT_SCHEMA_PROFILE=compact node scripts/rea.mjs mcp

The stdio script is the same as last time, plus five search_bytes calls. The tree shares one node_modules from npm ci, since the lockfiles match. Each test run sat under systemd-run --user --scope -p MemoryMax=8G.

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

@pablodiazjorge

Copy link
Copy Markdown
Contributor Author

@morluto, a short status note: the branch is merged with today's main (1f4da4d9c) and CI is green (39 checks), all review threads are resolved, and @CassieFox23 verified the fix on Linux on head 90f7011f7. Your comment on Oct 13 mentioned findings that still needed a separate decision or execution evidence; if anything there is waiting on me, let me know and I'll take care of it.

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

@pablodiazjorge

Copy link
Copy Markdown
Contributor Author

@morluto, the branch is now up to date with the 6.8.0 release (160d821ac). The only adaptation was in tests/boundary/mcp/inputKeyAliasesMcp.test.ts, which now builds its delivery with createToolResultDelivery after main removed the duplicate class (92f3298). CI is green, Codex and Greptile reviewed this head without findings (Greptile 5/5), all review threads are resolved, and I refreshed the validation in the description on this head. Ready for review whenever you have time.

Drop selector sentences that the shared input-group description already states, and keep canonical property descriptions off alias spellings.

@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: 7b6b9034d5

ℹ️ 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/contracts/inputKeyAliases.ts Outdated
property === null
)
return [name, property];
const { description: _description, ...rest } = property as Record<

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve canonical descriptions on alias properties

With REA_MCP_INPUT_SCHEMA_PROFILE=full, dropping the copied description here does not leave the alias neutral: toolInputSchemaWithMetadata subsequently invokes presentInputJsonSchema, whose PROPERTY_DESCRIPTIONS.query fallback labels it “Non-empty feature or text query to investigate.” This is fresh behavior beyond the removed selector sentence: for search_bytes, query is normalized to the masked-byte pattern and only accepts hex/?? syntax, so tools/list now guides models to send text that the runtime rejects (and optional filters such as get_objc_classes accept query: "" despite “Non-empty”). Preserve the canonical property's semantics or suppress the key-based fallback for alias properties.

AGENTS.md reference: AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed in 918a144. address has no key-based fallback, but query does, so dropping the copied description let the full profile describe search_bytes.query as a non-empty text query. Alias properties now carry Same as <canonical>. instead of a copy or nothing. That states the exact semantics on every tool, including search_bytes and the optional filters, and keeps the catalog within the frame: 1,047,927 bytes on Linux, 649 under. A new boundary test checks address on procedure_pseudo_code and query on search_strings and search_bytes in the full profile; it fails on 7b6b903.

An alias left without a description received the key-based fallback, which describes query as a text query even where it takes a byte pattern.

@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: 918a144e70

ℹ️ 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/contracts/inputKeyAliases.ts Outdated
// accepted alternatives here for schema consumers.
return {
...projected,
...(alternatives.length > 0 ? { anyOf: alternatives } : {}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep the Windows catalog within the stdio frame

On Windows, when a host uses the full input profile with output schemas off and enforces the repository's 1 MiB catalog frame, advertising these alternatives makes tools/list 1,049,062 bytes (the Windows run recorded for this change), exceeding 1,048,576; tests/boundary/mcp/outputSchemaProfile.test.ts:89-118 therefore already fails on this head. Such hosts cannot load any tools, so the aliases need a smaller advertisement (or the frame/delivery contract must be changed) before this profile remains usable.

AGENTS.md reference: AGENTS.md:L53-L54

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Fixed in dd000cb by advertising a smaller schema.

The aliases no longer advertise root alternatives. The projection now returns one strict object, which accepts exactly the alternatives:

  • their properties, with additionalProperties: false;
  • the keys that every alternative requires;
  • the same not exclusions, so one spelling per selector.

That removes the input-group sentence and the minProperties that the shared root-union presentation added to each tool. The aliases now cost 2,734 bytes instead of 5,082. The full catalog with output schemas off measures 1,045,579 bytes on Linux (2,997 under) and 1,046,979 bytes on Windows (1,597 under), and outputSchemaProfile.test.ts passes on both.

@morluto, this moves flattening into the alias projection, against the comment that kept the exact alternatives there for schema consumers. The accepted set is unchanged, and the unit and MCP tests check it with Ajv. I'm happy to revisit if you'd rather keep the alternatives and change the frame instead.

One object with the same exclusions accepts exactly the alternatives and avoids the per-tool input-group text, so the full catalog fits the 1 MiB frame on Windows too.
@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.

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

@pablodiazjorge

Copy link
Copy Markdown
Contributor Author

#8649 resolved #2146 the other way: address and query are rejected with field-level guidance toward procedure and pattern, and its tests on main expect those calls to fail. Accepting them as aliases, as this PR does, no longer fits that decision, so I'm closing it in favour of #8649. Thanks for the reviews here.

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 area: server Server layer and tool wiring enhancement New feature or request P2: medium Medium priority issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Help agents recover from common argument-name mistakes in procedure and search tools

5 participants