Expose section plane in render_preview MCP tool#515
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #514
Problem
headlessRenderalready supports a single axis-aligned clip plane (it's on thekernelcad render --sectionCLI), butrender_previewnever 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
render_previewinput:{ section: { axis: 'x'|'y'|'z', position: number, flip?: boolean } }.parseSectionFlagsopositionRawis kept verbatim — stringifying the number would emit exponent notation the page-side?section=regex silently rejects, producing an unclipped render.{ axis, position, positionRaw, flip }straight toheadlessRender, beside the existingenvironmentpass-through.Tests (TDD)
New
renderPreview.section.test.ts(4 cases): forwards a validated plane with verbatimpositionRaw; preserves negative/decimal positions andflip; omitssectionwhen absent; refuses a non-finite position. MCPtoolNameConsistencyandtoolRegistry.publicContractgates pass.Scope
Agent-facing render param only. Out of scope: multi-plane corner cutaway, a Studio UI section panel, and a
sectionView()script API.