Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Trim the subsurface MCP schema and accept its tool cost

Nguyen Xuan And59fa0dccfc3
diff --git a/changes/283.size.md b/changes/283.size.md
index 3e765714..25f39ca1 100644
--- a/changes/283.size.md
+++ b/changes/283.size.md
@@ -3,3 +3,8 @@
- scene:agent-scene: the same recipe field, lazy loader and capabilities line as entry:agent-scene.
- scene:agent-scene+lazy: the subsurface addon loads lazily, as in entry:agent-scene.
- archive: the subsurface addon (shader, limits) and docs ship in the package.
+- tool-total: the material schema gains one subsurface block (weight, radius, scale, color) that scene_create, scene_apply and scene_create_asset each carry, so an agent can write skin, wax and leaves in one call.
+- tool:scene_create: the material subsurface block, about 825 bytes.
+- tool:scene_apply: the material subsurface block, twice (add-material and set-material), about 1,650 bytes.
+- tool:scene_create_asset: the material subsurface block, about 825 bytes.
+- result:scene_capabilities: one line naming the subsurface block, with the ranges kept in the tool schema.
diff --git a/scripts/mcp-server.mjs b/scripts/mcp-server.mjs
index 47b2e726..cd72341c 100644
--- a/scripts/mcp-server.mjs
+++ b/scripts/mcp-server.mjs
@@ -102,13 +102,13 @@ const materialLayerFields = {
};
-const subsurfaceColor = (field, [minimum, maximum]) => z.tuple([0, 1, 2].map(() => z.number().min(minimum, `subsurface.${field} components must be at least ${minimum}.`).max(maximum, `subsurface.${field} components must be at most ${maximum}.`)));
+const subsurfaceTriple = ([minimum, maximum]) => z.tuple([0, 1, 2].map(() => z.number().min(minimum).max(maximum)));
const subsurface = z.strictObject({
- weight: z.number().min(SUBSURFACE_RANGES.weight[0]).max(SUBSURFACE_RANGES.weight[1]).optional().describe('Share of light that scatters under the surface; 0 is off.'),
- radius: subsurfaceColor('radius', SUBSURFACE_RANGES.radius).optional().describe('Red, green, blue mean free path in units of scale. Default [1, 0.2, 0.1] (skin).'),
- scale: z.number().min(SUBSURFACE_RANGES.scale[0]).max(SUBSURFACE_RANGES.scale[1]).optional().describe('Metres per radius unit. Default 0.05.'),
- color: subsurfaceColor('color', SUBSURFACE_RANGES.color).optional().describe('Linear RGB scatter colour; the base color when left out.'),
-}).describe('Light scattered under the surface (skin, wax, leaves), as Blender Principled BSDF Subsurface. Rasterizer only; the path tracer ignores it.');
+ weight: z.number().min(SUBSURFACE_RANGES.weight[0]).max(SUBSURFACE_RANGES.weight[1]).optional(),
+ radius: subsurfaceTriple(SUBSURFACE_RANGES.radius).optional().describe('RGB mean free path in scale units.'),
+ scale: z.number().min(SUBSURFACE_RANGES.scale[0]).max(SUBSURFACE_RANGES.scale[1]).optional().describe('Metres per radius unit.'),
+ color: subsurfaceTriple(SUBSURFACE_RANGES.color).optional(),
+}).describe('Subsurface scattering (skin, wax, leaves) as Blender Principled BSDF; details in scene_capabilities materialSubsurface.');
const materialFields = {
...materialLayerFields,