Skip to content

Expose section plane in render_preview MCP tool#515

Merged
w1ne merged 3 commits into
developfrom
feat/render-preview-section
Jun 25, 2026
Merged

Expose section plane in render_preview MCP tool#515
w1ne merged 3 commits into
developfrom
feat/render-preview-section

Conversation

@w1ne

@w1ne w1ne commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Closes #514

Problem

headlessRender already supports a single axis-aligned clip plane (it's on the kernelcad render --section CLI), but render_preview never surfaced it. The agent could only ever see a model's outer shell — never verify wall thickness, internal pockets, or whether a bore runs through.

Change

  • New render_preview input: { section: { axis: 'x'|'y'|'z', position: number, flip?: boolean } }.
  • Reuses the render CLI's parseSectionFlag so positionRaw is kept verbatim — stringifying the number would emit exponent notation the page-side ?section= regex silently rejects, producing an unclipped render.
  • Validates the plane and refuses an invalid one instead of rendering a misleading uncut view.
  • Forwards { axis, position, positionRaw, flip } straight to headlessRender, beside the existing environment pass-through.
  • Schema + tool description updated so the agent knows it can cut a cross-section to inspect interior geometry.

Tests (TDD)

New renderPreview.section.test.ts (4 cases): forwards a validated plane with verbatim positionRaw; preserves negative/decimal positions and flip; omits section when absent; refuses a non-finite position. MCP toolNameConsistency and toolRegistry.publicContract gates pass.

Scope

Agent-facing render param only. Out of scope: multi-plane corner cutaway, a Studio UI section panel, and a sectionView() script API.

w1ne added 3 commits June 23, 2026 19:23
The headless renderer already supports a single axis-aligned clip plane,
but render_preview never surfaced it — so the agent could only ever see a
model's outer shell, never verify wall thickness, internal pockets, or
whether a bore runs through.

Add a { section: { axis, position, flip? } } input that reuses the render
CLI's parseSectionFlag (keeping positionRaw verbatim so the page-side
?section= regex doesn't silently drop the clip), validates it, and
forwards a { axis, position, positionRaw, flip } plane to headlessRender.
Invalid sections refuse instead of rendering a misleading unclipped view.
@w1ne w1ne merged commit 38458b3 into develop Jun 25, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

render_preview can't show interior geometry (no section plane)

1 participant