Skip to content

3D engine that AI agents drive

Say the effects schema default for ambientOcclusion is 0 (#1984)

Nguyen Xuan An20f9e70f75d9
diff --git a/changes/1984.md b/changes/1984.md
new file mode 100644
index 00000000..dba0fb1b
--- /dev/null
+++ b/changes/1984.md
@@ -0,0 +1 @@
+- Fix: the `effects` tool schema no longer says ambient occlusion defaults to 0.7; it is 0 (off), as `scene_capabilities` `ambientOcclusion` and the runtime already say (#1984).
diff --git a/scripts/mcp-server.mjs b/scripts/mcp-server.mjs
index d1e9bbe2..d4020c22 100644
--- a/scripts/mcp-server.mjs
+++ b/scripts/mcp-server.mjs
@@ -329,7 +329,7 @@ const effects = z.strictObject({
temperature: bounded(-1, 1).optional(),
vignette: unit.optional(),
grain: bounded(0, 0.1).optional(),
- ambientOcclusion: unit.optional().describe('Screen-space contact darkening, 0 off to 1 full. Default 0.7 when unset; 0 skips the pass.'),
+ ambientOcclusion: unit.optional().describe('Screen-space contact darkening, 0 off to 1 full. Default 0 (off) when unset; above 0 turns the pass on.'),
ambientOcclusionRadius: bounded(0.01, 100).optional().describe('World-space reach of the occlusion; default 0.5.'),
bloom: z.strictObject({
strength: bounded(0, 2).optional(),
diff --git a/tests/ambient-occlusion-default-topics.test.js b/tests/ambient-occlusion-default-topics.test.js
new file mode 100644
index 00000000..63e96952
--- /dev/null
+++ b/tests/ambient-occlusion-default-topics.test.js
@@ -0,0 +1,46 @@
+import './support/load-agent-scene-modules.mjs';
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { Client } from '@modelcontextprotocol/client';
+import { InMemoryTransport } from '@modelcontextprotocol/server';
+import { createAgentMcpServer } from '../scripts/mcp-server.mjs';
+import { AGENT_SCENE_CAPABILITIES, normalizeAgentLook } from '../src/agent-scene.js';
+import { resolveEffects } from '../src/effects.js';
+
+// Issue 1984: the effects topic said AO defaults to 0.7 while the ambientOcclusion topic and the runtime default to 0.
+
+async function connectClient(context) {
+ const runtime = {
+ async capabilities() { return { scene: AGENT_SCENE_CAPABILITIES, phase: 'idle', availableIn: 'test' }; },
+ async close() {},
+ activeSessionId() { return null; },
+ };
+ const server = createAgentMcpServer(runtime);
+ const client = new Client({ name: 'ambient-occlusion-default-test', version: '1' });
+ const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
+ await server.connect(serverTransport);
+ await client.connect(clientTransport);
+ context.after(async () => {
+ await client.close();
+ await server.close();
+ });
+ return client;
+}
+
+async function readTopic(client, topic) {
+ const answer = await client.callTool({ name: 'scene_capabilities', arguments: { topic } });
+ assert.notEqual(answer.isError, true);
+ return answer.structuredContent;
+}
+
+test('both capability topics report the ambient occlusion default the runtime applies', async context => {
+ const runtimeDefault = resolveEffects({}).ambientOcclusion;
+ assert.equal(normalizeAgentLook({}).effects.ambientOcclusion, runtimeDefault);
+ const client = await connectClient(context);
+ const occlusionTopic = await readTopic(client, 'ambientOcclusion');
+ assert.equal(JSON.stringify(occlusionTopic).includes(`"default":${runtimeDefault}`), true);
+ const effectsText = JSON.stringify(await readTopic(client, 'effects'));
+ const stated = /ambientOcclusion[^]*?Default ([0-9.]+)/.exec(effectsText);
+ assert.ok(stated, 'the effects topic must state the ambientOcclusion default');
+ assert.equal(Number(stated[1]), runtimeDefault);
+});