refactor(server): classify preview toolkit exports#10281

merged1
cleanup-server/source-control-registry
cleanup-server/mcp-preview-internals
openedSep 6, 2026byJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 3d ago

The MCP preview toolkit had 14 unclassified runtime exports. This keeps each tool definition private to its toolkit assembly and removes the unused broad handler layer while retaining the standard and snapshot handler layers used by the server.

This is layer 8 of 9 in the server Knip cleanup stack.

Verification after rebasing onto current main: server typecheck and the server-only Knip export audit pass. Changed-file lint and formatting pass, with one existing lint warning. Focused auth, provider, source-control, preview toolkit, orchestration, and Knip preprocessor tests pass: 90 tests across 9 files. This changes server export visibility and static analysis; screenshots do not apply.

Model: gpt-6 astra. Harness: Codex in T3 Code.

Summary by CodeRabbit

  • Refactor
    • Simplified the preview toolkit’s internal structure without changing the behavior or schemas of available preview tools.
    • Preview tool definitions are no longer individually exposed through the public interface, while snapshot functionality remains available.
Synced from GitHub

Approvability

Verdict: Approved at e67ad63

Macroscope's review found this PR approvable — This is a small server-internal refactor that hides unused preview implementation symbols while preserving the exported toolkits and the existing standard/snapshot registration paths. No product defaults, runtime schemas, deployment behavior, or static-analysis configuration are changed.

No code changes detected at 210288f. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wire—13.6 KiB—15.1 KiB✅
CodexThread snapshot wire—7.0 KiB—7.3 KiB✅
CodexLive turn WebSocket wire—6.6 KiB—7.8 KiB✅
CodexLive turn WebSocket decoded—57.1 KiB—66.4 KiB✅
CodexLive turn messages—10—21✅
ClaudeTotal thread wire—13.6 KiB—15.1 KiB✅
ClaudeThread snapshot wire—7.1 KiB—7.3 KiB✅
ClaudeLive turn WebSocket wire—6.6 KiB—7.8 KiB✅
ClaudeLive turn WebSocket decoded—57.9 KiB—66.4 KiB✅
ClaudeLive turn messages—10—21✅

Baseline: unavailable · PR result: 210288f · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 113.9 KiB
  • Claude decoded thread snapshot: 114.6 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Synced from GitHub

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 6415c9ab-ad35-4389-ab1b-18830fc08587

📥 Commits

Reviewing files that changed from the base of the PR and between b0e2bc4a9f407af4b55224e32a61e04060d0747e and 72f32c81d5c3a5a09acbd0da96dd0d2299c5e789.

📒 Files selected for processing (2)
  • apps/server/src/mcp/toolkits/preview/handlers.ts
  • apps/server/src/mcp/toolkits/preview/tools.ts
💤 Files with no reviewable changes (1)
  • apps/server/src/mcp/toolkits/preview/handlers.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The preview toolkit narrows its exported API. Individual preview tools remain available internally, and the combined live handler export is removed.

Changes

Preview toolkit exports

Layer / File(s)Summary
Narrow preview tool exports
apps/server/src/mcp/toolkits/preview/tools.ts, apps/server/src/mcp/toolkits/preview/handlers.ts
Preview tool constants are no longer individually exported. The toolkit retains their behavior and definitions. PreviewToolkitHandlersLive is removed while standard and snapshot layers remain available.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 21028

Preview toolkit internals are no longer publicly exported while existing toolkit behavior remains unchanged. No current merge-blocking risk is identified.

Suggested reviewers: maria-rcks, t3dotgg

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
Title check✅ PassedThe title clearly and concisely describes the main change: classifying and reducing preview toolkit exports.
Description check✅ PassedThe description explains what changed, why the change was made, verification performed, and why screenshots do not apply. It does not use the template headings or checklist, but it provides the requir…
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cleanup-server/mcp-preview-internals

Comment @coderabbitai help to get the list of available commands.

Added 1 commit

  • refactor(server): keep preview toolkit internals private210288f