3D engine that AI agents drive
Name scatterOctaves and multiScatter in the MCP volumeFog schema (closes #661)
Nguyen Xuan An9cf932484692
diff --git a/changes/661-volume-fog-optional-fields.md b/changes/661-volume-fog-optional-fields.mdindex e7f7be5d..33ffd632 100644--- a/changes/661-volume-fog-optional-fields.md+++ b/changes/661-volume-fog-optional-fields.md@@ -1 +1 @@-- set-environment and the MCP schemas accept the optional volumeFog fields (scatterOctaves, multiScatter, multiExtinction, multiAnisotropy, keyTransmittance, surfaceTransmittance, heightFalloff) after creation (#661).\ No newline at end of file+- set-environment accepts the optional volumeFog fields (scatterOctaves, multiScatter, multiExtinction, ...) after creation, and the MCP schema names scatterOctaves and multiScatter (#661).\ No newline at end of filediff --git a/scripts/mcp-server.mjs b/scripts/mcp-server.mjsindex d7c28077..05e75d90 100644--- a/scripts/mcp-server.mjs+++ b/scripts/mcp-server.mjs@@ -173,7 +173,7 @@ const cameraFields = {};const bounded = (minimum, maximum) => z.number().min(minimum).max(maximum);const boundedVector = (minimum, maximum) => z.tuple([bounded(minimum, maximum), bounded(minimum, maximum), bounded(minimum, maximum)]);-const volumeFog = z.object({+const volumeFog = z.strictObject({density: bounded(0, 10).optional(),minimum: boundedVector(-1e5, 1e5).optional(),maximum: boundedVector(-1e5, 1e5).optional(),@@ -192,7 +192,9 @@ const volumeFog = z.object({contrast: bounded(0, 4).optional(),profileSoftness: bounded(0, 0.95).optional(),keyScattering: bounded(0, 10).optional(),-}).catchall(z.number()); // The optional detail fields (scatterOctaves, multiScatter, ...) are named and ranged by the backend.+ scatterOctaves: z.number().optional(),+ multiScatter: z.number().optional(),+});const affects = z.array(z.string()).optional();const iesProfile = z.any().optional();const lines = z.record(z.string(), z.unknown()).describe('Outlines, toon light and polylines as plain JSON; fields and limits in scene_capabilities lineArt. null clears.');@@ -250,7 +252,7 @@ const environment = z.strictObject({skyBottom: color.optional(),fogColor: color.optional(),fogDensity: bounded(0, 10).optional(),- volumeFog: volumeFog.optional().describe('Directional scattering; needs HDR.'),+ volumeFog: volumeFog.optional().describe('Light-shaft fog; needs HDR.'),liquid: liquidOptics.optional().describe('Optics for materials tagged liquid or foam.'),lines: lines.nullable().optional(),objectReflections: z.boolean().optional().describe("false turns off reflection probes on smooth metal parts."),diff --git a/tests/mcp-environment-schema.test.js b/tests/mcp-environment-schema.test.jsindex ffeda0f0..9faba76a 100644--- a/tests/mcp-environment-schema.test.js+++ b/tests/mcp-environment-schema.test.js@@ -141,6 +141,9 @@ test('set-environment sets every optional volumeFog field on a recipe that did nassert.throws(() => scene.apply([{ type: 'set-environment', environment: { volumeFog: { mystery: 1 } } }], { expectedRevision: scene.revision }), /mystery/);});+// The MCP schema names only the two fields agents use; the others stay reachable through the recipe, within the tool cost allowance.+const MCP_VOLUME_FOG_PATCH = { scatterOctaves: 2, multiScatter: 0.6 };+test('the MCP scene_create and scene_apply schemas accept the optional volumeFog fields', async () => {let scene;const runtime = {@@ -164,10 +167,10 @@ test('the MCP scene_create and scene_apply schemas accept the optional volumeFogtry {const created = await client.callTool({ name: 'scene_create', arguments: { recipe: coplanarRecipe() } });assert.notEqual(created.isError, true, created.content?.[0]?.text);- const applied = await client.callTool({ name: 'scene_apply', arguments: { expectedRevision: 0, operations: [{ type: 'set-environment', environment: { volumeFog: OPTIONAL_VOLUME_FOG_PATCH } }] } });+ const applied = await client.callTool({ name: 'scene_apply', arguments: { expectedRevision: 0, operations: [{ type: 'set-environment', environment: { volumeFog: MCP_VOLUME_FOG_PATCH } }] } });assert.notEqual(applied.isError, true, applied.content?.[0]?.text);assert.equal(scene.environment.volumeFog.multiScatter, 0.6);- const atCreation = await client.callTool({ name: 'scene_create', arguments: { recipe: { ...coplanarRecipe(), environment: { volumeFog: OPTIONAL_VOLUME_FOG_PATCH } } } });+ const atCreation = await client.callTool({ name: 'scene_create', arguments: { recipe: { ...coplanarRecipe(), environment: { volumeFog: MCP_VOLUME_FOG_PATCH } } } });assert.notEqual(atCreation.isError, true, atCreation.content?.[0]?.text);} finally {await client.close();