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.

feat(studio): add device-aware AR launch URL generation to tools

nirholasa73f98e82a2b
diff --git a/api/_mcp-studio/forge-client.js b/api/_mcp-studio/forge-client.js
index 519057c16..1b5698f10 100644
--- a/api/_mcp-studio/forge-client.js
+++ b/api/_mcp-studio/forge-client.js
@@ -41,6 +41,15 @@ export function viewerUrl(base, glbUrl) {
return `${base}/viewer?src=${encodeURIComponent(glbUrl)}`;
}
+// Device-aware AR launch link (api/ar.js): Android 302s straight into Scene
+// Viewer, iOS gets a Quick Look launch page (GLB→USDZ converted in-page), and
+// desktop falls back to the WebGL viewer. One URL places the model in the
+// user's real room on any phone — the same lane the /ar and /forge pages use.
+export function arUrl(base, glbUrl, title) {
+ const t = typeof title === 'string' && title.trim() ? `&title=${encodeURIComponent(title.trim().slice(0, 80))}` : '';
+ return `${base}/api/ar?src=${encodeURIComponent(glbUrl)}${t}`;
+}
+
// Device-aware "place it in your room" launcher (api/ar.js): Android gets a
// Scene Viewer intent, iOS a Quick Look launch page, desktop a WebGL fallback.
// One URL serves every device, which is exactly what a ChatGPT surface needs.
diff --git a/api/_mcp-studio/tools.js b/api/_mcp-studio/tools.js
index 90215f63b..7eacb965b 100644
--- a/api/_mcp-studio/tools.js
+++ b/api/_mcp-studio/tools.js
@@ -21,6 +21,7 @@ import { checkPromptSafety } from './safety.js';
import {
originFromReq,
viewerUrl,
+ arLaunchUrl,
generate,
rig,
directPrompt,
@@ -60,10 +61,12 @@ function firstPartyGlbUrl(glbUrl, base) {
function ok({ glbUrl, base, kind, prompt, rigged }) {
glbUrl = firstPartyGlbUrl(glbUrl, base);
const vUrl = viewerUrl(base, glbUrl);
+ const aUrl = arLaunchUrl(base, glbUrl, prompt);
const structured = {
kind,
glbUrl,
viewerUrl: vUrl,
+ arUrl: aUrl,
format: 'glb',
...(prompt ? { prompt } : {}),
...(rigged ? { rigged: true } : {}),