Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

test(mine): cover the merge and add the blender scene-info texture assertions

nirholas8a460a097ca1
diff --git a/packages/blender-mcp/src/tools/scene-info.js b/packages/blender-mcp/src/tools/scene-info.js
index 4331699ba..43d5ed80e 100644
--- a/packages/blender-mcp/src/tools/scene-info.js
+++ b/packages/blender-mcp/src/tools/scene-info.js
@@ -16,8 +16,11 @@ export const def = {
description:
'Open a 3D file with Blender and report what is inside it: object list with types, parents, dimensions and ' +
'modifiers; evaluated triangle and vertex counts; materials; armature bone names; animation actions with ' +
- 'their frame ranges; and world-space bounds. Accepts .blend plus every format this Blender can import ' +
- '(.glb, .gltf, .fbx, .obj, .stl, .ply, .dae, .abc, .usd*, .x3d). Read-only: the file is never modified.',
+ 'their frame ranges; a texture inventory with each image\'s resolution and byte size plus the total, which is ' +
+ 'usually what decides whether an asset is deliverable; and world-space bounds. Accepts .blend plus every ' +
+ 'format this Blender can import (.glb, .gltf, .fbx, .obj, .stl, .ply, .dae, .abc, .usd*, .x3d). Counts describe ' +
+ 'the file AS LOADED, so a GLB reports more vertices than the .blend it came from (glTF splits vertices at UV ' +
+ 'and normal seams) while the triangle count is identical. Read-only: the file is never modified.',
inputSchema: {
input: z.string().min(1).describe('Path to the 3D file to inspect. Absolute, or relative to the server working directory.'),
include_objects: z
diff --git a/packages/blender-mcp/test/blender-session.test.mjs b/packages/blender-mcp/test/blender-session.test.mjs
index d89ed9c72..b0602fa81 100644
--- a/packages/blender-mcp/test/blender-session.test.mjs
+++ b/packages/blender-mcp/test/blender-session.test.mjs
@@ -199,3 +199,65 @@ test('an unsupported output format fails with an actionable message', { skip: SK
assert.equal(payload.error, 'format_unsupported');
assert.match(payload.message, /Supported:/);
});
+
+test('blender_render hands the image back inline so the caller can see it', { skip: SKIP }, async () => {
+ const output = path.join(workdir, 'inline.png');
+ const result = await client.callTool({
+ name: 'blender_render',
+ arguments: { input: fixture, output, samples: 4, resolution: [1024, 1024] },
+ });
+ const image = result.content.find((block) => block.type === 'image');
+ assert.ok(image, 'the render must come back as an MCP image block, not just a path');
+ assert.equal(image.mimeType, 'image/png');
+ assert.ok(image.data.length > 100, 'the image block must carry real base64 data');
+
+ const payload = payloadOf(result);
+ // The full-resolution render stays on disk; only a scaled copy is inlined.
+ assert.equal(payload.resolution[0], 1024);
+ assert.ok(payload.preview_bytes < payload.output_bytes, 'the inlined copy must be smaller than the render');
+ await assert.rejects(stat(payload.preview), 'the scaled copy is temporary and must not be left behind');
+});
+
+test('inline_image: false suppresses the image block', { skip: SKIP }, async () => {
+ const result = await client.callTool({
+ name: 'blender_render',
+ arguments: { input: fixture, output: path.join(workdir, 'no-inline.png'), samples: 4, resolution: [160, 160], inline_image: false },
+ });
+ assert.ok(!result.content.some((block) => block.type === 'image'));
+ assert.equal(payloadOf(result).ok, true);
+});
+
+test('blender_scene_info reports the texture budget, not just an image count', { skip: SKIP }, async () => {
+ const textured = path.join(workdir, 'textured.glb');
+ await callTool('blender_run_python', {
+ output: textured,
+ code: [
+ 'import bpy',
+ 'bpy.ops.mesh.primitive_cube_add()',
+ "image = bpy.data.images.new('Albedo', width=512, height=512)",
+ "image.generated_type = 'COLOR_GRID'",
+ "material = bpy.data.materials.new('Textured')",
+ 'material.use_nodes = True',
+ "node = material.node_tree.nodes.new('ShaderNodeTexImage')",
+ 'node.image = image',
+ "material.node_tree.links.new(node.outputs['Color'], material.node_tree.nodes['Principled BSDF'].inputs['Base Color'])",
+ 'bpy.context.object.data.materials.append(material)',
+ ].join('\n'),
+ });
+
+ const { payload } = await callTool('blender_scene_info', { input: textured });
+ assert.equal(payload.textures.length, 1);
+ assert.deepEqual(payload.textures[0].resolution, [512, 512]);
+ assert.ok(payload.textures[0].bytes > 0, 'a packed texture must report its byte size');
+ assert.equal(payload.counts.texture_bytes, payload.textures[0].bytes);
+});
+
+test('parallel calls queue instead of exhausting the machine', { skip: SKIP }, async () => {
+ const results = await Promise.all(
+ Array.from({ length: 5 }, () => callTool('blender_scene_info', { input: fixture, include_objects: false })),
+ );
+ assert.ok(
+ results.every((r) => r.isError === false && r.payload.counts.meshes === 1),
+ 'every queued call must succeed',
+ );
+});
diff --git a/tests/mine-page.test.js b/tests/mine-page.test.js
new file mode 100644
index 000000000..6b9e1feb5
--- /dev/null
+++ b/tests/mine-page.test.js
@@ -0,0 +1,125 @@
+import { describe, it, expect } from 'vitest';
+import { readFileSync } from 'node:fs';
+import { fileURLToPath } from 'node:url';
+import { dirname, resolve } from 'node:path';
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+const repoRoot = resolve(__dirname, '..');
+const p = (...parts) => resolve(repoRoot, ...parts);
+const read = (...parts) => readFileSync(p(...parts), 'utf8');
+
+const html = read('pages/mine.html');
+const js = read('src/mine.js');
+const css = read('src/mine.css');
+
+describe('/mine page shell', () => {
+ it('loads its own module, stylesheet, nav and footer', () => {
+ expect(html).toContain('/src/mine.js');
+ expect(html).toContain('/src/mine.css');
+ expect(html).toContain('id="nav-container"');
+ expect(html).toContain('id="footer-container"');
+ });
+
+ it('is a personal page: canonical /mine and noindex', () => {
+ expect(html).toContain('https://three.ws/mine');
+ expect(html).toMatch(/name="robots" content="noindex/);
+ });
+
+ it('ships the type filters, the search box and the grid the module fills', () => {
+ for (const filter of ['all', 'agent', 'avatar', 'model']) {
+ expect(html).toContain(`data-filter="${filter}"`);
+ }
+ expect(html).toContain('id="mn-search-input"');
+ expect(html).toContain('id="mn-grid"');
+ });
+
+ it('tells a signed-out visitor why the page is partial, with a way in', () => {
+ expect(html).toContain('id="mn-anon-note"');
+ expect(html).toContain('/login?next=%2Fmine');
+ });
+});
+
+describe('/mine data sources', () => {
+ it('reads every real creation feed and never invents items', () => {
+ expect(js).toContain('/api/auth/me');
+ expect(js).toContain('/api/agents');
+ expect(js).toContain('/api/avatars/mine');
+ expect(js).toContain('/api/forge-gallery');
+ expect(js).toContain('/creations?limit=');
+ expect(js).not.toMatch(/const sample[A-Z]/);
+ });
+
+ it('scopes the anonymous forge feed to this browser and never to the shared bucket', () => {
+ // hashClient() maps a missing id to the shared 'anon' key, which would
+ // show one visitor another visitor's models. No id means no request.
+ expect(js).toContain("localStorage.getItem('forge:cid')");
+ expect(js).toContain("'x-forge-client'");
+ expect(js).toMatch(/if \(cid\) \{/);
+ });
+
+ it('distinguishes an empty account from an unreachable API', () => {
+ expect(js).toContain('result.failures === result.sources');
+ expect(js).toContain('Could not reach your creations');
+ });
+
+ it('bounds live WebGL contexts so a big library cannot exhaust the browser', () => {
+ expect(js).toContain('MAX_LIVE_VIEWERS');
+ expect(js).toContain('disposeViewer');
+ });
+
+ it('designs the loading, empty and error states rather than blanking the grid', () => {
+ expect(js).toContain('skeletons(');
+ expect(js).toContain('emptyStateHTML');
+ expect(js).toContain('errorStateHTML');
+ expect(css).toContain('.mn-skel');
+ });
+});
+
+describe('/mine is reachable', () => {
+ const vercel = JSON.parse(read('vercel.json'));
+ const routeFor = (src) => vercel.routes.find((r) => r.src === src);
+
+ it('routes /mine and /my-creations to the page', () => {
+ expect(routeFor('/mine/?')?.dest).toBe('/mine.html');
+ expect(routeFor('/my-creations/?')?.dest).toBe('/mine.html');
+ });
+
+ it('is a build input and a dev-server route', () => {
+ const vite = read('vite.config.js');
+ expect(vite).toContain("mine: resolve(__dirname, 'pages/mine.html')");
+ expect(vite).toContain("'/mine': resolve(root, 'pages/mine.html')");
+ });
+
+ it('is documented in the page index that feeds the sitemap and changelog', () => {
+ const pages = JSON.parse(read('data/pages.json'));
+ const entry = pages.sections.flatMap((s) => s.pages || []).find((x) => x.path === '/mine');
+ expect(entry).toBeTruthy();
+ expect(entry.title).toBe('My Creations');
+ });
+});
+
+describe('the way back to your work is one click from anywhere', () => {
+ it('sits in the desktop nav for signed-in visitors', () => {
+ const nav = read('public/nav.html');
+ expect(nav).toMatch(/href="\/mine"[^>]*id="home-nav-mine"/);
+ expect(nav).toMatch(/id="home-nav-mine"[^>]*data-auth="in"/);
+ // Authored hidden so the signed-out (and fetch-failed) default is safe.
+ expect(nav).toMatch(/id="home-nav-mine"[^>]*hidden/);
+ expect(nav).toContain('My creations');
+ });
+
+ it('sits in the mobile drawer and the Build menu', () => {
+ expect(read('public/nav.js')).toContain('id="home-nav-drawer-mine"');
+ const navData = read('public/nav-data.js');
+ expect(navData).toContain("href: '/mine'");
+ expect(navData).toContain("title: 'My Creations'");
+ });
+
+ it('is cross-linked from every surface where someone makes something', () => {
+ expect(read('pages/create.html')).toContain('href="/mine"');
+ expect(read('pages/create-agent.html')).toContain('href="/mine"');
+ expect(read('pages/forge.html')).toContain('href="/mine"');
+ expect(read('public/my-agents/index.html')).toContain('href="/mine"');
+ expect(read('src/dashboard-next/nav.js')).toContain("path: '/mine'");
+ });
+});