Skip to content

fix(mcp): keep detail guidance in compact input schemas - #8034

Merged
morluto merged 1 commit into
morluto:mainfrom
cpruijsen:fix/compact-detail-guidance
Nov 4, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
cpruijsen:fix/compact-detail-guidance

Conversation

@cpruijsen

@cpruijsen cpruijsen commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Compact input schemas are the default advertisement since #5975. In them, detail is advertised as a bare complete|summary enum with no description on 23 of the 31 tools that describe it in the full profile. On a universal macOS app, the default complete reply was about 699k characters for inspect_artifact (about 175k tokens) and 336k for inspect_macho (about 84k tokens). With detail=summary the same calls returned about 4.4k and 3.2k characters. In a run with a local model and a 131k context (LM Studio, Qwen 27B), complete replies filled the context before the model wrote any answer.

This keeps the contract's detail description in the compact profile.

No issue is linked. I hit this while running REA from LM Studio on that app.

Problem and expected behavior

Trigger: tools/list with the default (compact) profile. inspect_artifact, inspect_macho, analyze_function, binary_session, decode_interface_builder, list_strings, search_procedures and 16 other tools describe detail in the full profile but not in compact. The inline compact form strips all nested descriptions, while the reduced form already keeps first-level guidance.

Expected: a caller on the compact profile can see that summary exists and keeps the complete Evidence retained.

Change and scope

compactAdvertisedInputSchema in src/contracts/compactInputSchema.ts restores the description of a root detail property after annotations are stripped and local references are expanded. The text is the contract's own, so the contract stays the single owner of the wording. Other annotations stay stripped, and the shared stripAnnotations in compactJsonSchema.ts is unchanged, so compact output schemas do not change. docs/mcp-contracts.md documents the exception.

Not included: 14 tools (for example inspect_android_package, inspect_dart_aot, analyze_javascript_application, get_evidence_bundle) have no detail description in either profile. That is a contract change and is left for a follow-up.

Contribution scope: ordinary fix within existing boundaries; not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: compact input-schema presentation (src/contracts/compactInputSchema.ts).

  • Contribution scope fit and linked maintainer decision: not applicable.

  • CLI and MCP/tool-catalog contract: compact tools/list input schemas only. Full profile, output schemas, tool descriptions and canonical validation are unchanged. The compact catalog digest changes.

  • Provider, bridge, target-format, or platform compatibility: compact input schemas grow from 127,616 to 133,358 bytes across 233 tools (+5,742, +4.5%). The largest schema stays at 4,107 bytes, within the 13,312-byte budget.

  • Evidence, artifact, provenance, or reconstruction contract: none.

  • Target selection, authority, upstream behavior, and cleanup details: not applicable.

  • Generated metadata, package, or installation impact: none.

  • 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: keeps root detail guidance so callers can choose bounded summaries in tests/boundary/mcp/compactInputSchemaMcp.test.ts lists the full and compact catalogs through the MCP transport and requires equal detail descriptions.
  • Base reproduction or other evidence: on b3d31ed the test fails with expected { …(8) } to deeply equal { …(31) }. It passes with the change. The reply sizes in the summary come from MCP tools/call on rea 6.7.0 against a real universal macOS app.
  • User-visible CLI/MCP output: compact inspect_macho detail now reads {"type":"string","enum":["complete","summary"],"description":"Omitted or complete returns the complete inspection Evidence. summary retains that complete Evidence in this session and returns its inspect_analysis_view summary; use normalized_result.parent_evidence_id for macho pages."}.
  • Remaining proof gaps: no re-run with Kimi/Moonshot or LM Studio after the change, so improved tool selection is not yet shown.

Validation performed

  • npm run test:focused -- tests/boundary/mcp/compactInputSchemaMcp.test.ts src/contracts/compactInputSchema.test.ts tests/conformance/contracts/mcpInputSchemaProfile.test.ts tests/boundary/mcp/toolInputAdmission.test.ts tests/boundary/mcp/outputSchemaProfile.test.ts: 5 files, 70 tests passed
  • npm run check:fast: passed
  • npm run verify:test-discovery: all 2840 test files discovered once
  • npm run docs:check: passed

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS only. The change is a platform-independent JSON transform and was not run on Windows or Linux.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none needed; no runtime behavior changes.

Author readiness

Human owner: @cpruijsen

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

Compact input schemas are the default advertisement since morluto#5975, and the
profile drops every property description. On 23 of the 31 tools with a
guided `detail` option, including inspect_artifact and inspect_macho,
`detail` is advertised as a bare complete|summary enum, so callers take the
complete default. On a universal macOS app that reply was about 699k
characters for inspect_artifact and 336k for inspect_macho, against about
4.4k and 3.2k with summary.

Keep the canonical description of a root `detail` property in the inline
compact input form. The reduced form already keeps first-level guidance, and
compact output schemas are unchanged. Advertised compact input schemas grow
from 127,616 to 133,358 bytes across 233 tools; the largest schema stays at
4,107 bytes, within the 13,312-byte budget.

The new boundary test compares `detail` guidance between the full and compact
tools/list and fails before the change.
@chatgpt-codex-connector

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-29T14:37:54.558003Z
We couldn’t complete this review. Comment @codex review to try again.
0ed67f9 PR opened
ℹ️ 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

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.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Low impact] The PR appears safe to merge; no actionable defects were found.

Summary

Preserves existing root detail descriptions in compact input schemas, documents the exception, and adds a catalog-wide MCP regression.

  • Compact MCP listings explain what the detail choice does.

Reviews (1) · Last reviewed commit: "fix(mcp): keep detail guidance in compac..." · Reviewed by Greptile

@morluto
morluto merged commit 5b953e1 into morluto:main Nov 4, 2026
42 of 47 checks passed
@morluto morluto added area: mcp MCP server, transport, and tool registration bug Something isn't working labels Nov 22, 2026
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 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants