virtualmatter 0.7.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/dist/admin.js +167 -0
- package/dist/agentfiles.js +1 -1
- package/dist/agents-md.generated.js +1 -1
- package/dist/asset-commands.js +8 -0
- package/dist/assets.js +75 -1
- package/dist/depth.js +119 -0
- package/dist/files.js +45 -19
- package/dist/index.js +35 -9
- package/dist/mcp.js +70 -5
- package/dist/server-lifecycle.js +410 -0
- package/package.json +1 -1
package/dist/files.js
CHANGED
|
@@ -10,6 +10,7 @@ import { pipeline } from "node:stream/promises";
|
|
|
10
10
|
import { authorizedFetch, resolveSession, sessionBaseUrl } from "./api.js";
|
|
11
11
|
import { DOWNLOAD_TEMP_MARKER } from "./ignore.js";
|
|
12
12
|
import { getEngineRestarts } from "./world-status.js";
|
|
13
|
+
import { decodeDepth } from "./depth.js";
|
|
13
14
|
/**
|
|
14
15
|
* The session API's per-write cap (session-agent server/api/files.py
|
|
15
16
|
* MAX_WRITE_BYTES). A bigger PUT is answered 413, so sync skips such files
|
|
@@ -499,26 +500,28 @@ export class FilesClient {
|
|
|
499
500
|
}
|
|
500
501
|
}
|
|
501
502
|
async screenshot(opts = {}) {
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
503
|
+
const res = await this.requestScreenshot(screenshotBody(opts));
|
|
504
|
+
return Buffer.from(await res.arrayBuffer());
|
|
505
|
+
}
|
|
506
|
+
async screenshotDepth(opts = {}) {
|
|
507
|
+
if (opts.clientId !== undefined) {
|
|
508
|
+
throw new Error("Depth is read from the server's own view; it does not combine with a client capture.");
|
|
507
509
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
camera_pos_x: px,
|
|
513
|
-
camera_pos_y: py,
|
|
514
|
-
camera_pos_z: pz,
|
|
515
|
-
camera_rot_x: rx,
|
|
516
|
-
camera_rot_y: ry,
|
|
517
|
-
camera_rot_z: rz,
|
|
518
|
-
});
|
|
510
|
+
const res = await this.requestScreenshot({ ...screenshotBody(opts), depth: true });
|
|
511
|
+
if (!(res.headers.get("Content-Type") ?? "").includes("json")) {
|
|
512
|
+
// A session agent older than depth support ignores the flag and answers a bare image.
|
|
513
|
+
throw new Error("This world's session predates depth capture and answered a plain picture. Restart the world from its editor page so it gets a current session, then try again.");
|
|
519
514
|
}
|
|
520
|
-
|
|
521
|
-
|
|
515
|
+
const body = (await res.json());
|
|
516
|
+
if (!body.image?.data)
|
|
517
|
+
throw new Error("The screenshot answer has no image.");
|
|
518
|
+
return {
|
|
519
|
+
image: Buffer.from(body.image.data, "base64"),
|
|
520
|
+
mediaType: body.image.media_type ?? "image/png",
|
|
521
|
+
depth: decodeDepth(body.depth),
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
async requestScreenshot(body) {
|
|
522
525
|
const res = await this.send("/engine/screenshot", {
|
|
523
526
|
method: "POST",
|
|
524
527
|
headers: { "Content-Type": "application/json" },
|
|
@@ -526,8 +529,31 @@ export class FilesClient {
|
|
|
526
529
|
}, "safe");
|
|
527
530
|
if (!res.ok)
|
|
528
531
|
throw new Error(await engineErrorMessage(res, "Screenshot"));
|
|
529
|
-
return
|
|
532
|
+
return res;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
function screenshotBody(opts) {
|
|
536
|
+
const body = {};
|
|
537
|
+
if (opts.target) {
|
|
538
|
+
body.target_object_id = opts.target;
|
|
539
|
+
if (opts.distance !== undefined)
|
|
540
|
+
body.distance = opts.distance;
|
|
541
|
+
}
|
|
542
|
+
else if (opts.at || opts.rot) {
|
|
543
|
+
const [px, py, pz] = opts.at ?? [0, 20, 20];
|
|
544
|
+
const [rx, ry, rz] = opts.rot ?? [0, -45, 0];
|
|
545
|
+
Object.assign(body, {
|
|
546
|
+
camera_pos_x: px,
|
|
547
|
+
camera_pos_y: py,
|
|
548
|
+
camera_pos_z: pz,
|
|
549
|
+
camera_rot_x: rx,
|
|
550
|
+
camera_rot_y: ry,
|
|
551
|
+
camera_rot_z: rz,
|
|
552
|
+
});
|
|
530
553
|
}
|
|
554
|
+
if (opts.clientId !== undefined)
|
|
555
|
+
body.client_id = opts.clientId;
|
|
556
|
+
return body;
|
|
531
557
|
}
|
|
532
558
|
/**
|
|
533
559
|
* A client for the editor session of `framingId` that follows the session
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { registerLogCommands } from "./log-commands.js";
|
|
6
|
+
import { describeEngineState, getEngineState, registerLifecycleCommands } from "./server-lifecycle.js";
|
|
7
|
+
import { registerAdminCommands } from "./admin.js";
|
|
6
8
|
import { Command } from "commander";
|
|
7
9
|
import { createProject, createWebsiteBuild, getWebsiteBuild, getEmbed, defaultRegion, editUrl, fetchNativeClientCatalog, listProjects, playUrl, NotEditFramingError, authorizedFetch, resolveEditSession, resolveSession, whoami, } from "./api.js";
|
|
8
10
|
import { NotLoggedInError, clearCredentials, loadCredentials, pollForToken, saveCredentials, startDeviceFlow, } from "./auth.js";
|
|
@@ -10,6 +12,7 @@ import { openInBrowser } from "./browser.js";
|
|
|
10
12
|
import { detectPlatform, ensureClientInstalled, launchClient, seedNativeAuth } from "./client.js";
|
|
11
13
|
import { apiBase, packageVersion } from "./config.js";
|
|
12
14
|
import { ENGINE_TIMEOUT_EXIT_CODE, EngineTimeoutError, editSessionClient } from "./files.js";
|
|
15
|
+
import { depthPaths, depthToNpy, depthToPreviewPng, describeDepth } from "./depth.js";
|
|
13
16
|
import { acquireFolderLock } from "./lock.js";
|
|
14
17
|
import { runMcpServer } from "./mcp.js";
|
|
15
18
|
import { defaultErrorsStateFile, runAtomo } from "./atomo.js";
|
|
@@ -503,21 +506,25 @@ program
|
|
|
503
506
|
}));
|
|
504
507
|
program
|
|
505
508
|
.command("status")
|
|
506
|
-
.description("
|
|
509
|
+
.description("Whether the world's editor server is running or stopped, its engine iteration (editor and each play server, and any announced move), its play servers: whether each matches the editor, which scene they load, and how the last update went")
|
|
507
510
|
.argument("[dir]", "a synced folder", ".")
|
|
508
511
|
.option("--json", "machine-readable output")
|
|
509
512
|
.action((dir, opts) => run(async () => {
|
|
510
|
-
const
|
|
511
|
-
const
|
|
513
|
+
const framingId = requireState(path.resolve(dir)).framing_id;
|
|
514
|
+
const project = await projectForEditor(framingId);
|
|
515
|
+
const [drift, last, engine, server] = await Promise.all([
|
|
512
516
|
getDrift(project.id),
|
|
513
517
|
getPublishRun(project.id),
|
|
514
518
|
// advice: a platform without the endpoint still answers the rest
|
|
515
519
|
getEngineIterations(project.id).catch(() => null),
|
|
520
|
+
getEngineState(framingId).catch(() => null),
|
|
516
521
|
]);
|
|
517
522
|
if (opts.json) {
|
|
518
|
-
console.log(JSON.stringify({ project: project.name, montage_id: project.id, engine, drift, last_update: last }, null, 2));
|
|
523
|
+
console.log(JSON.stringify({ project: project.name, montage_id: project.id, server, engine, drift, last_update: last }, null, 2));
|
|
519
524
|
return;
|
|
520
525
|
}
|
|
526
|
+
if (server)
|
|
527
|
+
console.log(describeEngineState(server));
|
|
521
528
|
if (engine)
|
|
522
529
|
for (const line of formatIterations(engine))
|
|
523
530
|
console.log(line);
|
|
@@ -620,7 +627,7 @@ function triple(value, flag) {
|
|
|
620
627
|
}
|
|
621
628
|
program
|
|
622
629
|
.command("screenshot")
|
|
623
|
-
.description("Capture a PNG of the world - a default overview, or aimed with --at/--rot or --target")
|
|
630
|
+
.description("Capture a PNG of the world - a default overview, or aimed with --at/--rot or --target. --depth also saves the frame's depth in metres")
|
|
624
631
|
.argument("[dir]", "a synced folder", ".")
|
|
625
632
|
.option("-o, --out <file>", "output file", "screenshot.png")
|
|
626
633
|
.option("--at <x,y,z>", "camera position (default: 0,20,20)")
|
|
@@ -628,17 +635,32 @@ program
|
|
|
628
635
|
.option("--target <id-or-name>", "frame this object instead of using a camera pose")
|
|
629
636
|
.option("--distance <meters>", "framing distance for --target (default: from the object's bounds)")
|
|
630
637
|
.option("--client <id>", "capture through this connected client, UI included; with no --at/--rot/--target it is exactly what that client sees")
|
|
638
|
+
.option("--depth", "also read the frame's depth buffer: <out>.depth.npy (float32 metres along the view axis, height x width, 0 = sky), <out>.depth.png (preview, near is white) and <out>.depth.json (camera and range). Not with --client")
|
|
631
639
|
.action((dir, opts) => run(async () => {
|
|
632
640
|
const { client } = await clientForDir(path.resolve(dir));
|
|
633
|
-
const
|
|
641
|
+
const aim = {
|
|
634
642
|
at: opts.at ? triple(opts.at, "--at") : undefined,
|
|
635
643
|
rot: opts.rot ? triple(opts.rot, "--rot") : undefined,
|
|
636
644
|
target: opts.target,
|
|
637
645
|
distance: opts.distance === undefined ? undefined : Number(opts.distance),
|
|
638
646
|
clientId: opts.client === undefined ? undefined : clientIdFlag(opts.client),
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
|
|
647
|
+
};
|
|
648
|
+
if (!opts.depth) {
|
|
649
|
+
const png = await client.screenshot(aim);
|
|
650
|
+
fs.writeFileSync(opts.out, png);
|
|
651
|
+
console.log(`Wrote ${opts.out} (${png.length} bytes).`);
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
if (aim.clientId !== undefined)
|
|
655
|
+
fail("--depth reads the server's own view; drop --client.");
|
|
656
|
+
const shot = await client.screenshotDepth(aim);
|
|
657
|
+
const files = depthPaths(opts.out);
|
|
658
|
+
fs.writeFileSync(opts.out, shot.image);
|
|
659
|
+
fs.writeFileSync(files.npy, depthToNpy(shot.depth));
|
|
660
|
+
fs.writeFileSync(files.png, depthToPreviewPng(shot.depth));
|
|
661
|
+
fs.writeFileSync(files.json, JSON.stringify(shot.depth.info, null, 2) + "\n");
|
|
662
|
+
console.log(`Wrote ${opts.out} (${shot.image.length} bytes), ${files.npy}, ${files.png} and ${files.json}.`);
|
|
663
|
+
console.log(describeDepth(shot.depth.info));
|
|
642
664
|
}));
|
|
643
665
|
/** Install the native client if needed, sign it in, and launch it into a world. */
|
|
644
666
|
async function openNative(framingId, url, force = false) {
|
|
@@ -726,6 +748,8 @@ program
|
|
|
726
748
|
.option("--method <m>", "FloodFill (solid, default), ShellOnly, RayCast (open or non-watertight meshes, terrain), Projections, Polymender")
|
|
727
749
|
.option("--rotate <x,y,z>", "rotate the source by these degrees first, e.g. -90,0,0 for a Z-up model")
|
|
728
750
|
.option("--no-shading", "don't bake lighting into the voxel colours")
|
|
751
|
+
.option("--image-stack", "the zip is a stack of slice images (CT, MRI, any volume): one pixel becomes one voxel. Detected on its own when the zip holds only images or a stack.json")
|
|
752
|
+
.option("--threshold <0..1>", "image stacks: a voxel is solid where the slice value is above this (default 0.5)")
|
|
729
753
|
.option("--name <name>", "the asset's name (default: the file name; one source only)")
|
|
730
754
|
.option("--attach", "attach the results to a world (--project, else the synced folder here)")
|
|
731
755
|
.option("--place <x,y,z>", "also place each one in the world, its 0,0,0 at this position (implies --attach)")
|
|
@@ -818,6 +842,8 @@ program
|
|
|
818
842
|
await runMcpServer(path.resolve(dir), opts.framing);
|
|
819
843
|
}));
|
|
820
844
|
registerLogCommands(program);
|
|
845
|
+
registerLifecycleCommands(program, run);
|
|
846
|
+
registerAdminCommands(program, run);
|
|
821
847
|
program.parseAsync(process.argv).catch((err) => {
|
|
822
848
|
fail(err instanceof Error ? err.message : String(err));
|
|
823
849
|
});
|
package/dist/mcp.js
CHANGED
|
@@ -11,13 +11,19 @@ import { eventSchema } from "./log-events.js";
|
|
|
11
11
|
* and `select_project` work in that state, and every world-bound tool says
|
|
12
12
|
* how to pick one.
|
|
13
13
|
*/
|
|
14
|
+
import fs from "node:fs";
|
|
15
|
+
import os from "node:os";
|
|
16
|
+
import path from "node:path";
|
|
14
17
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
15
18
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
16
19
|
import { z } from "zod";
|
|
17
20
|
import { createProject, createWebsiteBuild, getWebsiteBuild, getEmbed, defaultRegion, editUrl, listProjects, playUrl, resolveEditSession, resolveSession, sessionBaseUrl, } from "./api.js";
|
|
21
|
+
import { adminGet, listAdminWorlds } from "./admin.js";
|
|
22
|
+
import { describeEngineState, getEngineState, runLifecycle } from "./server-lifecycle.js";
|
|
18
23
|
import { attachAsset, findAsset, getJob, assetForJob, listAssets, listProjectAssets, placeInWorld, voxelizeSource, } from "./assets.js";
|
|
19
24
|
import { ensureClientInstalled, launchClient, seedNativeAuth } from "./client.js";
|
|
20
25
|
import { packageVersion } from "./config.js";
|
|
26
|
+
import { depthToNpy, depthToPreviewPng, describeDepth } from "./depth.js";
|
|
21
27
|
import { ConflictError, editSessionClient } from "./files.js";
|
|
22
28
|
import { acquireFolderLock } from "./lock.js";
|
|
23
29
|
import { pullCommand } from "./pull.js";
|
|
@@ -248,6 +254,14 @@ export async function runMcpServer(dir, framingFlag) {
|
|
|
248
254
|
description: "Check a VM build by build_id. Do not create another project to check progress. Review the world and enable sharing before embedding.",
|
|
249
255
|
inputSchema: { build_id: z.string() },
|
|
250
256
|
}, async ({ build_id }) => textResult(JSON.stringify(await getWebsiteBuild(build_id))));
|
|
257
|
+
server.registerTool("admin_list_worlds", {
|
|
258
|
+
description: "Platform admins only, read-only: every account's worlds with owner handle and email, region, tier, and edit/play URLs. Filter with search (name, slug or an id) and owner (handle or email). A maker account gets a not-an-admin error. Use this to find another account's world instead of calling the admin API by hand.",
|
|
259
|
+
inputSchema: { search: z.string().optional(), owner: z.string().optional() },
|
|
260
|
+
}, async ({ search, owner }) => textResult(JSON.stringify(await listAdminWorlds({ search, owner }), null, 2)));
|
|
261
|
+
server.registerTool("admin_get", {
|
|
262
|
+
description: "Platform admins only, read-only: GET one admin API read and return its JSON. path is relative to /api/v1/admin, for example framings, users, sessions, hosts, hosts/metrics, analytics/frame-time. query holds optional query parameters. It cannot change anything and cannot reach outside the admin API.",
|
|
263
|
+
inputSchema: { path: z.string(), query: z.record(z.string()).optional() },
|
|
264
|
+
}, async ({ path: adminPath, query }) => textResult(JSON.stringify(await adminGet(adminPath, query ?? {}), null, 2)));
|
|
251
265
|
server.registerTool("list_projects", {
|
|
252
266
|
description: "List the signed-in maker's Virtual Matter projects (worlds): name, id, region, the editing framing id, and edit/play URLs. Call this to find a world to work in, then select_project.",
|
|
253
267
|
inputSchema: {},
|
|
@@ -405,6 +419,39 @@ export async function runMcpServer(dir, framingFlag) {
|
|
|
405
419
|
return textResult(JSON.stringify(await getEngineRestarts(framing, Math.min(tail ?? 20, 200)), null, 2));
|
|
406
420
|
return textResult(JSON.stringify(await getEngineLog(framing, Math.max(1, tail ?? 100)), null, 2));
|
|
407
421
|
});
|
|
422
|
+
const lifecycleTool = (verb, description, extra) => server.registerTool(`${verb}_server`, { description, inputSchema: extra }, async (args) => {
|
|
423
|
+
const notes = [];
|
|
424
|
+
const result = await runLifecycle(verb, ctx.requireFraming(), {
|
|
425
|
+
force: args.force === true,
|
|
426
|
+
yes: args.yes === true,
|
|
427
|
+
noWait: args.wait === false,
|
|
428
|
+
timeoutS: typeof args.timeout_seconds === "number" ? args.timeout_seconds : undefined,
|
|
429
|
+
resetTerrain: args.reset_terrain === true,
|
|
430
|
+
}, { log: (line) => notes.push(line) });
|
|
431
|
+
return { ...textResult(JSON.stringify({ ...result, notes }, null, 2)), isError: result.exitCode !== 0 };
|
|
432
|
+
});
|
|
433
|
+
const lifecycleExits = "The result's exitCode is 0 done, 1 the platform reported a failure, 2 nothing was done, 3 sent but the outcome is unknown (check server_status before sending it again).";
|
|
434
|
+
const force = z.boolean().optional().describe("Stop without letting the engine save, for a stuck engine. Unsaved changes are lost");
|
|
435
|
+
const yes = z.boolean().optional().describe("Go ahead although clients are connected (they are disconnected). Without it the call is refused and says how many");
|
|
436
|
+
const wait = z.boolean().optional().describe("Wait until the engine answers Lua again (default true). A large world loads for minutes");
|
|
437
|
+
const timeout_seconds = z.number().positive().optional().describe("How long to wait (default 900)");
|
|
438
|
+
lifecycleTool("restart", `Restart the selected world's editor server: the same operation as the web editor's Restart button, and the only way to get a clean engine process (Server:ReloadScene() reloads inside the same process and returns no memory). The engine saves first unless force is set. Waits until the engine answers Lua, then returns the seconds taken and Server:GetMemoryUsage(). Never restarts play servers. ${lifecycleExits}`, { force, yes, wait, timeout_seconds });
|
|
439
|
+
lifecycleTool("stop", `Stop the selected world's editor server and leave it stopped, letting the engine save first unless force is set. It starts again when someone opens the world, or with start_server. ${lifecycleExits}`, { force, yes, timeout_seconds });
|
|
440
|
+
lifecycleTool("start", `Start the selected world's editor server if it is stopped and wait until it answers Lua; a running server is left alone. ${lifecycleExits}`, {
|
|
441
|
+
wait,
|
|
442
|
+
timeout_seconds,
|
|
443
|
+
reset_terrain: z
|
|
444
|
+
.boolean()
|
|
445
|
+
.optional()
|
|
446
|
+
.describe("Only for a world stopped after running out of memory: swap its terrain for an empty grid (the old one is kept in a backup folder on the server), then start. Never set it unless the maker asked"),
|
|
447
|
+
});
|
|
448
|
+
server.registerTool("server_status", {
|
|
449
|
+
description: "Whether the selected world's editor server is running, starting or stopped, how many clients are connected, and whether it was stopped for running out of memory. Reading it never starts a stopped server.",
|
|
450
|
+
inputSchema: {},
|
|
451
|
+
}, async () => {
|
|
452
|
+
const state = await getEngineState(ctx.requireFraming());
|
|
453
|
+
return textResult(JSON.stringify({ ...state, summary: describeEngineState(state) }, null, 2));
|
|
454
|
+
});
|
|
408
455
|
server.registerTool("play_server_status", {
|
|
409
456
|
description: "The selected world's engine iteration (the editor's and each play server's, what each last booted, any mismatch between them, an announced platform move, and a link to what changed in the API) and its play servers (what visitors play): whether each still matches the editor, which scene they load and when the editor last saved it, and how the last update went (per server). Use it before and after publish_play_servers, and when engine behaviour looks different from what you expect.",
|
|
410
457
|
inputSchema: {},
|
|
@@ -499,18 +546,36 @@ export async function runMcpServer(dir, framingFlag) {
|
|
|
499
546
|
.positive()
|
|
500
547
|
.optional()
|
|
501
548
|
.describe("Capture through this connected client, UI (HUD, menus) included - a server capture never shows UI. With no target/at/rot it is exactly what that client sees."),
|
|
549
|
+
depth: z
|
|
550
|
+
.boolean()
|
|
551
|
+
.optional()
|
|
552
|
+
.describe("Also read the frame's depth buffer (server view only, not with client_id). Returns a depth preview image (near is white, sky black) and its range, and saves the metres as a float32 .npy (height x width, distance along the view axis, 0 = sky) whose path is in the answer. One capture, no raycasts."),
|
|
502
553
|
},
|
|
503
|
-
}, async ({ target, at, rot, client_id }) => {
|
|
554
|
+
}, async ({ target, at, rot, client_id, depth }) => {
|
|
504
555
|
const client = await ctx.getClient();
|
|
505
|
-
const
|
|
556
|
+
const aim = {
|
|
506
557
|
target,
|
|
507
558
|
at: at,
|
|
508
559
|
rot: rot,
|
|
509
560
|
clientId: client_id,
|
|
510
|
-
}
|
|
561
|
+
};
|
|
562
|
+
if (!depth) {
|
|
563
|
+
const png = await client.screenshot(aim);
|
|
564
|
+
return {
|
|
565
|
+
content: [{ type: "image", data: png.toString("base64"), mimeType: "image/png" }],
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
const shot = await client.screenshotDepth(aim);
|
|
569
|
+
const npy = path.join(os.tmpdir(), `virtualmatter-depth-${Date.now()}.npy`);
|
|
570
|
+
fs.writeFileSync(npy, depthToNpy(shot.depth));
|
|
511
571
|
return {
|
|
512
572
|
content: [
|
|
513
|
-
{ type: "image", data:
|
|
573
|
+
{ type: "image", data: shot.image.toString("base64"), mimeType: shot.mediaType },
|
|
574
|
+
{ type: "image", data: depthToPreviewPng(shot.depth).toString("base64"), mimeType: "image/png" },
|
|
575
|
+
{
|
|
576
|
+
type: "text",
|
|
577
|
+
text: JSON.stringify({ summary: describeDepth(shot.depth.info), npy, ...shot.depth.info }),
|
|
578
|
+
},
|
|
514
579
|
],
|
|
515
580
|
};
|
|
516
581
|
});
|
|
@@ -532,7 +597,7 @@ export async function runMcpServer(dir, framingFlag) {
|
|
|
532
597
|
*/
|
|
533
598
|
const captureWorld = () => captureWorldTarget(ctx.requireFraming());
|
|
534
599
|
server.registerTool("voxelize_model", {
|
|
535
|
-
description: "Turn a 3D file on this machine (glb gltf fbx obj stl; ply pts xyz e57 las laz point clouds; vox; zip) into a voxel asset in the maker's library, on Virtual Matter's voxelizer: uploads it (resumable, up to 10 GiB), voxelizes it, and waits. With attach=true it also goes into the selected world's Assets/ folder, and with place it is put in the scene. The asset keeps the source's own coordinates in metres: place moves the source's 0,0,0, so map tiles placed with the same offset line up. Voxelizing takes seconds for a small model and can take an hour for a huge one; with wait=false it returns the job at once (poll get_voxelize_job). If placement fails the result says placed:false with the reason.",
|
|
600
|
+
description: "Turn a 3D file on this machine (glb gltf fbx obj stl; ply pts xyz e57 las laz point clouds; vox; zip of models, or a zip of slice images such as CT or MRI, which becomes one solid volume with one voxel per pixel) into a voxel asset in the maker's library, on Virtual Matter's voxelizer: uploads it (resumable, up to 10 GiB), voxelizes it, and waits. With attach=true it also goes into the selected world's Assets/ folder, and with place it is put in the scene. The asset keeps the source's own coordinates in metres: place moves the source's 0,0,0, so map tiles placed with the same offset line up. Voxelizing takes seconds for a small model and can take an hour for a huge one; with wait=false it returns the job at once (poll get_voxelize_job). If placement fails the result says placed:false with the reason.",
|
|
536
601
|
inputSchema: {
|
|
537
602
|
path: z.string().describe("Local file path, or an upload id to voxelize again"),
|
|
538
603
|
voxels_per_meter: z.number().positive().optional().describe("Rounded to a power of two. Default 4 (25 cm voxels); city blocks 2-4, props 32-128"),
|