Skip to content

Commit ba52922

Browse files
Fix Gemini empty build retries and expand build-plan v2 support
1 parent 4ee2c8f commit ba52922

File tree

4 files changed

+973
-60
lines changed

4 files changed

+973
-60
lines changed

README.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,10 +393,18 @@ The build-plan tool accepts either:
393393
- or a wrapper object with top-level `build_plan`
394394

395395
Important top-level planning fields:
396-
- `coordMode`: `player` or `absolute`
397-
- `origin`: in `player` mode this is a relative shift from the player; in `absolute` mode it is an explicit world origin
396+
- `label` or `summary`: human-readable build name
397+
- `version`: set `2` for the richer semantic build-plan contract
398+
- `coordMode`: `player`, `absolute`, or `anchor`
399+
- `origin`: in `absolute` mode this is an explicit world origin
398400
- `offset`: optional extra relative shift after the base origin
401+
- `anchor`: anchor reference such as `last_build:door` when `coordMode=anchor`
399402
- `autoFix`: allows safe grounding fixes like small auto-lowers and limited support repair
403+
- `snapToGround`: opt-in grounding adjustment
404+
- `flattenTerrain`: opt-in terrain flattening across the footprint
405+
- `clearVegetation`: opt-in replaceable-plant clearing in the footprint
406+
- `options.rotation`: `0`, `90`, `180`, `270`, `cw`, or `ccw`
407+
- `anchors`: named relative anchor points remembered after successful builds
400408

401409
Minimal example:
402410

@@ -417,6 +425,18 @@ Supported aliases are intentionally flexible:
417425
- block id: `block`, `material`, or `id`
418426
- properties: `properties` or `state`
419427
- geometry: `from/to`, `start/end`, `start + size`, `location + size`, `location + dimensions`
428+
- vanilla-style block-state strings also work, for example `minecraft:oak_stairs[facing=east,half=top]`
429+
430+
Semantic step types in `steps[]` now include:
431+
- `cuboid`
432+
- `hollow_cuboid`
433+
- `columns`
434+
- `blocks`
435+
- `windows`
436+
- `roof`
437+
- `fill`
438+
- `repeat`
439+
- `scatter`
420440

421441
#### Planner Semantics Agents Should Follow
422442

@@ -425,13 +445,17 @@ Agents should not treat the build planner as a black box. The most important rul
425445
- `minecraft_buildsite` returns terrain deltas relative to the player’s current block Y, not absolute world Y.
426446
- If `maxDy` is negative, the surrounding surface is below the player. A build with floor `y=0` will float unless the plan is lowered or the player moves.
427447
- `coordMode=absolute` is the right choice when the structure needs to stay locked to a specific world location instead of wherever the player happens to be standing.
428-
- If `coordMode=absolute` is used without `origin`, the planner falls back to the player’s block position and reports that fallback in `repairs`.
448+
- `coordMode=anchor` lets one build attach to anchors created by an earlier successful build, for example `last_build:door`.
449+
- If `coordMode=absolute` is used without `origin`, the planner now rejects the plan instead of silently falling back.
429450
- `clearPercent` is headroom above sampled surface columns, not proof that the terrain is flat.
430451
- The planner clamps relative X/Z into `[-32, 32]` and relative Y into `[-24, 24]`. If a plan is too large or too far away, the result includes repairs saying it was clamped into the safe build window.
431-
- `steps` should be used for phased builds like foundation -> shell -> roof -> details.
452+
- `steps` should be used for phased builds like foundation -> shell -> roof -> details, and step order is preserved unless `options.phaseReorder=true`.
432453
- `clear` volumes remove space before building and use the same bounds formats as cuboids, but without a block id.
454+
- `clear` can also use the v2 object form with `enabled`, `dx`, `dy`, `dz`, `offset`, and `replaceWith`.
433455
- `rotate` accepts `0`, `90`, `180`, `270`, `cw`, and `ccw`, and the result reports the final normalized value in `appliedRotation`.
434456
- `phaseCount` reports how many direct-operation phases were compiled from `clear`, `cuboids`, `blocks`, and `steps`.
457+
- `hollow_cuboid` should be preferred over solid-fill-then-air hacks for rooms and wall shells.
458+
- `roof` lets the planner generate common roof forms directly instead of forcing the agent to hand-author every shrinking rectangle.
435459
- The planner now returns structured `issues` identifying floating cuboids or block targets, their `gapBelow`, and a `suggestedY` to ground them correctly.
436460
- The planner only adds support pillars for real unsupported columns and caps auto-support at 24 columns.
437461
- If more than 80% of the lowest build columns are already within 2 blocks of solid ground and `autoFix=true`, the planner can auto-lower the whole build instead of spamming pillars.

run-mcp-sidecar-node.js

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -302,19 +302,24 @@ const TOOLS = {
302302
inputSchema: objectSchema(),
303303
},
304304
minecraft_preview_build_plan: {
305-
description: "Compile and validate a structured voxel build plan without executing it, returning previewCommands, planId, resolvedOrigin, issues, repairs, rotation, and phase data.",
305+
description: "Compile and validate a structured voxel build plan without executing it, including v2 semantic steps like hollow_cuboid, columns, windows, roof, repeat, and scatter. Returns previewCommands, planId, resolvedOrigin, issues, repairs, rotation, and phase data.",
306306
method: "POST",
307307
path: "/v1/actions/preview_build_plan",
308308
inputSchema: {
309309
type: "object",
310-
description: "Either provide build_plan explicitly or pass the build_plan object as the root arguments object. Supports coordMode=player|absolute, explicit origin, offset, autoFix, clear, cuboids, blocks, and steps.",
310+
description: "Either provide build_plan explicitly or pass the build_plan object as the root arguments object. Supports version=2 plans, coordMode=player|absolute|anchor, explicit origin, offset, anchors, snapToGround, flattenTerrain, clearVegetation, autoFix, clear, cuboids, blocks, and typed semantic steps.",
311311
additionalProperties: true,
312312
properties: {
313313
build_plan: { type: "object", additionalProperties: true },
314-
coordMode: { type: "string", enum: ["player", "absolute"] },
314+
coordMode: { type: "string", enum: ["player", "absolute", "anchor"] },
315315
origin: { type: "object", additionalProperties: true },
316316
offset: { type: "object", additionalProperties: true },
317+
anchor: { type: "string" },
317318
autoFix: { type: "boolean" },
319+
snapToGround: { type: "boolean" },
320+
flattenTerrain: { type: "boolean" },
321+
clearVegetation: { type: "boolean" },
322+
options: { type: "object", additionalProperties: true },
318323
},
319324
},
320325
},
@@ -325,21 +330,26 @@ const TOOLS = {
325330
inputSchema: highlightSchema(),
326331
},
327332
minecraft_execute_build_plan: {
328-
description: "Compile and execute a structured voxel build plan using the mod's planner, with validation, absolute/player origins, support diagnostics, preview parity via planId, and undo-aware batching.",
333+
description: "Compile and execute a structured voxel build plan using the mod's planner, including v2 semantic steps, terrain options, anchor origins, support diagnostics, preview parity via planId, and undo-aware batching.",
329334
method: "POST",
330335
path: "/v1/actions/execute_build_plan",
331336
inputSchema: {
332337
type: "object",
333-
description: "Either provide build_plan explicitly, pass the build_plan object as the root arguments object, or send executePlanId/planId from minecraft_preview_build_plan to execute the exact cached preview unchanged.",
338+
description: "Either provide build_plan explicitly, pass the build_plan object as the root arguments object, or send executePlanId/planId from minecraft_preview_build_plan to execute the exact cached preview unchanged. Supports the v2 semantic build vocabulary and terrain flags.",
334339
additionalProperties: true,
335340
properties: {
336341
build_plan: { type: "object", additionalProperties: true },
337342
executePlanId: { type: "string" },
338343
planId: { type: "string" },
339-
coordMode: { type: "string", enum: ["player", "absolute"] },
344+
coordMode: { type: "string", enum: ["player", "absolute", "anchor"] },
340345
origin: { type: "object", additionalProperties: true },
341346
offset: { type: "object", additionalProperties: true },
347+
anchor: { type: "string" },
342348
autoFix: { type: "boolean" },
349+
snapToGround: { type: "boolean" },
350+
flattenTerrain: { type: "boolean" },
351+
clearVegetation: { type: "boolean" },
352+
options: { type: "object", additionalProperties: true },
343353
},
344354
},
345355
},
@@ -839,23 +849,33 @@ function buildBuildPlanGuide() {
839849
"",
840850
"## Common Top-Level Fields",
841851
"",
842-
"- `summary`: short description of the structure",
843-
"- `coordMode`: `player` or `absolute`",
844-
"- `origin`: explicit origin. In `player` mode it is a relative shift from the player. In `absolute` mode it is a real world origin.",
852+
"- `label` or `summary`: short description of the structure",
853+
"- `version`: schema version. `2` enables the richer semantic build-plan style.",
854+
"- `coordMode`: `player`, `absolute`, or `anchor`",
855+
"- `origin`: explicit origin. In `absolute` mode it is a real world origin.",
845856
"- `offset`: optional extra relative shift applied after the base origin",
857+
"- `anchor`: anchor reference such as `last_build:door` when `coordMode=anchor`",
846858
"- `autoFix`: whether the planner may auto-lower near-ground builds and add limited support repair",
859+
"- `snapToGround`: opt-in origin grounding adjustment",
860+
"- `flattenTerrain`: opt-in flattening of the footprint to origin Y",
861+
"- `clearVegetation`: opt-in clearing of replaceable plants in the footprint",
847862
"- `rotate`: `0`, `90`, `180`, `270`, `cw`, or `ccw`",
863+
"- `options.rotation`: v2 rotation field if you keep metadata under `options`",
864+
"- `options.phaseReorder`: default false. If false, step order is sacred.",
848865
"- `palette`: aliases for block ids, useful for custom mod blocks",
866+
"- `anchors`: named relative points created by the build for later attachment",
849867
"- `clear`: volumes to clear before building",
850868
"- `cuboids`: bulk structural geometry",
851869
"- `blocks`: single-block details",
852870
"- `steps`: phased sub-plans for larger structures",
871+
"- Semantic step `type`s: `cuboid`, `hollow_cuboid`, `columns`, `blocks`, `windows`, `roof`, `fill`, `repeat`, `scatter`",
853872
"",
854873
"## Coordinate Rules",
855874
"",
856875
"- `coordMode=player` means the plan is relative to the active player.",
857876
"- `coordMode=absolute` means `origin` is an explicit world coordinate and cuboid/block coordinates are relative to that absolute origin.",
858-
"- If `coordMode=absolute` is used without `origin`, the planner falls back to the player's current block position and reports that fallback in `repairs`.",
877+
"- `coordMode=anchor` means the planner resolves a previously remembered anchor reference such as `last_build:door` or `Some Label:door` and uses that as the base origin.",
878+
"- If `coordMode=absolute` is used without `origin`, the planner rejects the plan.",
859879
"- Positive `x` is east, positive `y` is up, positive `z` is south.",
860880
"- Keep small test structures close to the origin, for example between `-8` and `8` on x/z.",
861881
"- The planner clamps X/Z into `[-32, 32]` and Y into `[-24, 24]`. If you exceed that window, the plan is repaired and reported as clamped.",
@@ -889,11 +909,23 @@ function buildBuildPlanGuide() {
889909
"- `block`",
890910
"- `material`",
891911
"- `id`",
912+
"- full vanilla-style blockstate strings like `minecraft:oak_stairs[facing=east,half=top]`",
892913
"",
893914
"Block properties may be provided as:",
894915
"- `properties`",
895916
"- `state`",
896917
"",
918+
"## Semantic Step Vocabulary",
919+
"",
920+
"- `cuboid`: solid rectangular fill",
921+
"- `hollow_cuboid`: shell-only room or wall box",
922+
"- `columns`: repeat vertical pillars at listed x/z positions",
923+
"- `blocks`: individual entries with exact block ids and optional block states",
924+
"- `windows`: semantic glass replacement regions",
925+
"- `roof`: declarative roof generator for `flat`, `pyramid`, `gable`, `hip`, or `dome`-style output",
926+
"- `repeat`: repeated posts or details using `start`, `step`, and `count`",
927+
"- `scatter`: decorative random surface placement in a bounded region",
928+
"",
897929
"## Good Planning Habits",
898930
"",
899931
"- Keep plans compact and structural.",
@@ -902,6 +934,8 @@ function buildBuildPlanGuide() {
902934
"- If terrain is uneven, inspect with `minecraft_buildsite` first.",
903935
"- If the structure is larger, use `steps` so the plan reads like phases instead of one giant blob.",
904936
"- Treat `clear` as a surgical pre-build removal step, not a vague instruction to hollow things out automatically.",
937+
"- Prefer `hollow_cuboid` for rooms instead of solid-fill-then-air tricks.",
938+
"- Prefer `roof` for small structures if you want the planner to own the roof geometry.",
905939
"",
906940
"## Minimal Valid Plan",
907941
"",

0 commit comments

Comments
 (0)