ue-mcp-tripo 0.2.2 → 0.2.3

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.
@@ -174,7 +174,7 @@ Boolean requesting whether a visible border and background is provided by the ho
174
174
  - omitted: host decides border`)}),Fb=u.object({method:u.literal("ui/request-display-mode"),params:u.object({mode:Gt.describe("The display mode being requested.")})}),cb=u.object({mode:Gt.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),mb=u.union([u.literal("model"),u.literal("app")]).describe("Tool visibility scope - who can access the tool."),Wb=u.object({resourceUri:u.string().optional(),visibility:u.array(mb).optional().describe(`Who can access this tool. Default: ["model", "app"]
175
175
  - "model": Tool visible to and callable by the agent
176
176
  - "app": Tool callable by the app from this server only`),csp:u.never().optional(),permissions:u.never().optional()}),Kb=u.object({mimeTypes:u.array(u.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),Vb=u.object({method:u.literal("ui/download-file"),params:u.object({contents:u.array(u.union([tp,ip])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),Bb=u.object({method:u.literal("ui/message"),params:u.object({role:u.literal("user").describe('Message role, currently only "user" is supported.'),content:u.array(ln).describe("Message content blocks (text, image, etc.).")})}),Gb=u.object({method:u.literal("ui/notifications/sandbox-resource-ready"),params:u.object({html:u.string().describe("HTML content to load into the inner iframe."),sandbox:u.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:vl.optional().describe("CSP configuration from resource metadata."),permissions:hl.optional().describe("Sandbox permissions from resource metadata.")})}),pb=u.object({method:u.literal("ui/notifications/tool-result"),params:qr.describe("Standard MCP tool execution result.")}),up=u.object({toolInfo:u.object({id:nn.optional().describe("JSON-RPC id of the tools/call request."),tool:gl.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:X$.optional().describe("Current color theme preference."),styles:sb.optional().describe("Style configuration for theming the app."),displayMode:Gt.optional().describe("How the UI is currently displayed."),availableDisplayModes:u.array(Gt).optional().describe("Display modes the host supports."),containerDimensions:u.union([u.object({height:u.number().describe("Fixed container height in pixels.")}),u.object({maxHeight:u.union([u.number(),u.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(u.union([u.object({width:u.number().describe("Fixed container width in pixels.")}),u.object({maxWidth:u.union([u.number(),u.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
177
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:u.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:u.string().optional().describe("User's timezone in IANA format."),userAgent:u.string().optional().describe("Host application identifier."),platform:u.union([u.literal("web"),u.literal("desktop"),u.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:u.object({touch:u.boolean().optional().describe("Whether the device supports touch input."),hover:u.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:u.object({top:u.number().describe("Top safe area inset in pixels."),right:u.number().describe("Right safe area inset in pixels."),bottom:u.number().describe("Bottom safe area inset in pixels."),left:u.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),fb=u.object({method:u.literal("ui/notifications/host-context-changed"),params:up.describe("Partial context update containing only changed fields.")}),Xb=u.object({method:u.literal("ui/update-model-context"),params:u.object({content:u.array(ln).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:u.record(u.string(),u.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),Yb=u.object({method:u.literal("ui/initialize"),params:u.object({appInfo:Mr.describe("App identification (name and version)."),appCapabilities:db.describe("Features and capabilities this app provides."),protocolVersion:u.string().describe("Protocol version this app supports.")})}),gb=u.object({protocolVersion:u.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Mr.describe("Host application identification and version."),hostCapabilities:lb.describe("Features and capabilities provided by the host."),hostContext:up.describe("Rich context about the host environment.")}).passthrough(),vb={target:"draft-2020-12"};async function Bl(e,i){let n=e["~standard"];if(n.jsonSchema)return n.jsonSchema[i](vb);if(n.vendor==="zod"){let{z:a}=await Promise.resolve().then(()=>(Rr(),qm));return a.toJSONSchema(e,{io:i})}throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function Gl(e,i,n=""){let a=await e["~standard"].validate(i);if(a.issues){let t=a.issues.map(r=>{let o=r.path?.map(s=>typeof s=="object"?s.key:s).join(".");return o?`${o}: ${r.message}`:r.message}).join("; ");throw Error(n+t)}return a.value}Rr();function lp(e){let i=document.documentElement;i.setAttribute("data-theme",e),i.style.colorScheme=e}function dp(e,i=document.documentElement){for(let[n,a]of Object.entries(e))a!==void 0&&i.style.setProperty(n,a)}function cp(e){if(document.getElementById("__mcp-host-fonts"))return;let i=document.createElement("style");i.id="__mcp-host-fonts",i.textContent=e,document.head.appendChild(i)}var Cn=class Cn extends ta{constructor(n,a={},t={autoResize:!0}){super(t);D(this,"_appInfo");D(this,"_capabilities");D(this,"options");D(this,"_hostCapabilities");D(this,"_hostInfo");D(this,"_hostContext");D(this,"_registeredTools",{});D(this,"_initializedSent",!1);D(this,"eventSchemas",{toolinput:nb,toolinputpartial:rb,toolresult:pb,toolcancelled:ab,hostcontextchanged:fb});D(this,"_everHadListener",new Set);D(this,"_toolHandlersInitialized",!1);D(this,"_onteardown");D(this,"_oncalltool");D(this,"_onlisttools");D(this,"sendOpenLink",this.openLink);this._appInfo=n,this._capabilities=a,this.options=t,t.allowUnsafeEval||u.config({jitless:!0}),this.setRequestHandler(Lr,r=>(console.log("Received ping:",r.params),{})),this.setEventHandler("hostcontextchanged",void 0)}_assertInitialized(n){if(this._initializedSent)return;let a=`[ext-apps] App.${n}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(a);console.warn(`${a}. This will throw in a future release.`)}_assertHandlerTiming(n){if(!Cn.ONE_SHOT_EVENTS.has(n)||this._everHadListener.has(n)||(this._everHadListener.add(n),!this._initializedSent))return;let a=`[ext-apps] "${String(n)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(a);console.warn(a)}setEventHandler(n,a){a&&this._assertHandlerTiming(n),super.setEventHandler(n,a)}addEventListener(n,a){this._assertHandlerTiming(n),super.addEventListener(n,a)}onEventDispatch(n,a){n==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...a})}registerCapabilities(n){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._capabilities=V$(this._capabilities,n)}registerTool(n,a,t){if(this._registeredTools[n])throw Error(`Tool ${n} is already registered`);let r=this,o=()=>{r._initializedSent&&r._capabilities.tools?.listChanged&&r.sendToolListChanged()},s=a.inputSchema!==void 0,l={title:a.title,description:a.description,inputSchema:a.inputSchema,outputSchema:a.outputSchema,annotations:a.annotations,_meta:a._meta,enabled:!0,enable(){this.enabled=!0,o()},disable(){this.enabled=!1,o()},update(d){Object.assign(this,d),o()},remove(){r._registeredTools[n]===l&&(delete r._registeredTools[n],o())},handler:async(d,c)=>{if(!l.enabled)throw Error(`Tool ${n} is disabled`);let f;if(s){let g=l.inputSchema,_=g?await Gl(g,d??{},`Invalid input for tool ${n}: `):d??{};f=await t(_,c)}else f=await t(c);return l.outputSchema&&!f.isError&&(f.structuredContent=await Gl(l.outputSchema,f.structuredContent,`Invalid output for tool ${n}: `)),f}};return this._registeredTools[n]=l,!this._capabilities.tools&&!this.transport&&this.registerCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),o(),l}ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(n,a)=>{let t=this._registeredTools[n.name];if(!t)throw Error(`Tool ${n.name} not found`);return t.handler(n.arguments,a)},this.onlisttools=async(n,a)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([t,r])=>r.enabled).map(async([t,r])=>{let o={name:t,title:r.title,description:r.description,inputSchema:r.inputSchema?await Bl(r.inputSchema,"input"):{type:"object",properties:{}}};return r.outputSchema&&(o.outputSchema=await Bl(r.outputSchema,"output")),r.annotations&&(o.annotations=r.annotations),r._meta&&(o._meta=r._meta),o}))}))}async sendToolListChanged(n={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:n})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(n){this.setEventHandler("toolinput",n)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(n){this.setEventHandler("toolinputpartial",n)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(n){this.setEventHandler("toolresult",n)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(n){this.setEventHandler("toolcancelled",n)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(n){this.setEventHandler("hostcontextchanged",n)}get onteardown(){return this._onteardown}set onteardown(n){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,n),this._onteardown=n,this.replaceRequestHandler(ub,(a,t)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(a.params,t)})}get oncalltool(){return this._oncalltool}set oncalltool(n){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,n),this._oncalltool=n,this.replaceRequestHandler(rp,(a,t)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(a.params,t)})}get onlisttools(){return this._onlisttools}set onlisttools(n){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,n),this._onlisttools=n,this.replaceRequestHandler(np,(a,t)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(a.params,t)})}assertCapabilityForMethod(n){switch(n){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${n})`);break}}assertRequestHandlerCapability(n){switch(n){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${n})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${n} registered`)}}assertNotificationCapability(n){}assertTaskCapability(n){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(n){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(n,a){if(this._assertInitialized("callServerTool"),typeof n=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${n}"). Did you mean: callServerTool({ name: "${n}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:n},qr,{onprogress:()=>{},resetTimeoutOnProgress:!0,...a})}async readServerResource(n,a){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:n},ep,a)}async listServerResources(n,a){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:n},Qm,a)}async createSamplingMessage(n,a){this._assertInitialized("createSamplingMessage");let t=n.tools?sp:op;return await this.request({method:"sampling/createMessage",params:n},t,a)}sendMessage(n,a){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:n},ib,a)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,a){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:n},el,a)}openLink(n,a){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:n},eb,a)}downloadFile(n,a){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:n},tb,a)}requestTeardown(n={}){return this.notification({method:"ui/notifications/request-teardown",params:n})}requestDisplayMode(n,a){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:n},cb,a)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,a=0,t=0,r=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let s=document.documentElement,l=s.style.height;s.style.height="max-content";let d=Math.ceil(s.getBoundingClientRect().height);s.style.height=l;let c=Math.ceil(window.innerWidth);(c!==a||d!==t)&&(a=c,t=d,this.sendSizeChanged({width:c,height:d}))}))};r();let o=new ResizeObserver(r);return o.observe(document.documentElement),o.observe(document.body),()=>o.disconnect()}async connect(n=new ia(window.parent,window.parent),a){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1,await super.connect(n);try{let t=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:B$}},gb,a);if(t===void 0)throw Error(`Server sent invalid initialize result: ${t}`);this._hostCapabilities=t.hostCapabilities,this._hostInfo=t.hostInfo,this._hostContext=t.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(t){throw this.close(),t}}};D(Cn,"ONE_SHOT_EVENTS",new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]));var Rn=Cn;var hb="https://developers.tripo3d.ai/en/keys",$b="https://developers.tripo3d.com/zh/keys",K=e=>document.getElementById(e),Se=new Rn({name:"Tripo settings",version:"0.2.2"},{});async function dn(e,i={}){let n=await Se.callServerTool({name:`tripo_${e}`,arguments:i}),a=(n.content??[]).find(t=>t.type==="text")?.text??"";if(n.isError)throw new Error(a.replace(/^Error \[[A-Z_]+\]:\s*/,"")||"The call failed.");try{return JSON.parse(a)}catch{throw new Error(a||"The call returned nothing.")}}function Ee(e){for(let i of["save","clear","signin","region"])K(i).disabled=e;e||(K("clear").disabled=!$l||$l.key.source!=="store")}function he(e){let i=K("error");i.textContent=e??"",i.hidden=!e}var $l=null;function _l(e){$l=e;let i=K("account");if(e.signedIn){let n=[e.account??"Signed in"];e.region&&n.push(e.region==="cn"?"China mainland":"International"),typeof e.balance=="number"&&n.push(`${e.balance.toLocaleString()} credits`),i.textContent=n.join(" \xB7 "),i.dataset.state="ok"}else i.textContent="Not signed in. Save an API key or sign in with Tripo.",i.dataset.state="off";K("keystate").textContent=e.key.source==="env"?"Set by the TRIPO_API_KEY environment variable, which takes precedence over a saved key.":e.key.source==="store"?"A key is saved.":"No key is saved.",K("clear").disabled=e.key.source!=="store"}async function bl(){he(null);try{_l(await dn("auth_status"))}catch(e){he(e.message)}}async function bb(e){e.preventDefault();let i=K("apikey"),n=i.value.trim();if(!n){he("Enter an API key first.");return}Ee(!0),he(null);try{_l(await dn("set_key",{apiKey:n})),i.value=""}catch(a){he(a.message)}finally{Ee(!1)}}async function _b(){Ee(!0),he(null);try{_l(await dn("clear_key"))}catch(e){he(e.message)}finally{Ee(!1)}}var At=null;function mp(){At&&clearTimeout(At),At=null}async function yb(){mp(),Ee(!0),he(null);let e=K("region").value;try{let i=await dn("login_start",{region:e});if(!i.url){K("device").hidden=!0,await bl(),Ee(!1);return}K("code").textContent=i.code??"",K("open").onclick=()=>void Se.openLink({url:i.url}),K("device").hidden=!1,K("pollstate").textContent="Waiting for you to approve the code in your browser.",Se.openLink({url:i.url});let n=async()=>{let a;try{a=await dn("login_poll")}catch(t){a={state:"error",message:t.message}}if(a.state==="pending"){At=setTimeout(()=>void n(),i.pollAfterMs||5e3);return}At=null,Ee(!1),a.state==="done"?(K("device").hidden=!0,await bl()):(K("pollstate").textContent=a.state==="expired"?"The code expired. Sign in again for a new one.":"",a.state==="error"&&he(a.message??"Sign-in failed."))};At=setTimeout(()=>void n(),i.pollAfterMs||5e3)}catch(i){he(i.message),Ee(!1)}}function pp(e){e&&(e.theme&&lp(e.theme),e.styles?.variables&&dp(e.styles.variables),e.styles?.css?.fonts&&cp(e.styles.css.fonts))}Se.onhostcontextchanged=e=>pp({...Se.getHostContext(),...e});Se.onteardown=async()=>(mp(),{});K("keyform").addEventListener("submit",e=>void bb(e));K("clear").addEventListener("click",()=>void _b());K("signin").addEventListener("click",()=>void yb());K("getkey").addEventListener("click",e=>{e.preventDefault(),Se.openLink({url:K("region").value==="cn"?$b:hb})});Se.connect().then(()=>{pp(Se.getHostContext()),bl()}).catch(e=>he(`Could not reach the host: ${e.message}`));})();
177
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:u.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:u.string().optional().describe("User's timezone in IANA format."),userAgent:u.string().optional().describe("Host application identifier."),platform:u.union([u.literal("web"),u.literal("desktop"),u.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:u.object({touch:u.boolean().optional().describe("Whether the device supports touch input."),hover:u.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:u.object({top:u.number().describe("Top safe area inset in pixels."),right:u.number().describe("Right safe area inset in pixels."),bottom:u.number().describe("Bottom safe area inset in pixels."),left:u.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),fb=u.object({method:u.literal("ui/notifications/host-context-changed"),params:up.describe("Partial context update containing only changed fields.")}),Xb=u.object({method:u.literal("ui/update-model-context"),params:u.object({content:u.array(ln).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:u.record(u.string(),u.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),Yb=u.object({method:u.literal("ui/initialize"),params:u.object({appInfo:Mr.describe("App identification (name and version)."),appCapabilities:db.describe("Features and capabilities this app provides."),protocolVersion:u.string().describe("Protocol version this app supports.")})}),gb=u.object({protocolVersion:u.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Mr.describe("Host application identification and version."),hostCapabilities:lb.describe("Features and capabilities provided by the host."),hostContext:up.describe("Rich context about the host environment.")}).passthrough(),vb={target:"draft-2020-12"};async function Bl(e,i){let n=e["~standard"];if(n.jsonSchema)return n.jsonSchema[i](vb);if(n.vendor==="zod"){let{z:a}=await Promise.resolve().then(()=>(Rr(),qm));return a.toJSONSchema(e,{io:i})}throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function Gl(e,i,n=""){let a=await e["~standard"].validate(i);if(a.issues){let t=a.issues.map(r=>{let o=r.path?.map(s=>typeof s=="object"?s.key:s).join(".");return o?`${o}: ${r.message}`:r.message}).join("; ");throw Error(n+t)}return a.value}Rr();function lp(e){let i=document.documentElement;i.setAttribute("data-theme",e),i.style.colorScheme=e}function dp(e,i=document.documentElement){for(let[n,a]of Object.entries(e))a!==void 0&&i.style.setProperty(n,a)}function cp(e){if(document.getElementById("__mcp-host-fonts"))return;let i=document.createElement("style");i.id="__mcp-host-fonts",i.textContent=e,document.head.appendChild(i)}var Cn=class Cn extends ta{constructor(n,a={},t={autoResize:!0}){super(t);D(this,"_appInfo");D(this,"_capabilities");D(this,"options");D(this,"_hostCapabilities");D(this,"_hostInfo");D(this,"_hostContext");D(this,"_registeredTools",{});D(this,"_initializedSent",!1);D(this,"eventSchemas",{toolinput:nb,toolinputpartial:rb,toolresult:pb,toolcancelled:ab,hostcontextchanged:fb});D(this,"_everHadListener",new Set);D(this,"_toolHandlersInitialized",!1);D(this,"_onteardown");D(this,"_oncalltool");D(this,"_onlisttools");D(this,"sendOpenLink",this.openLink);this._appInfo=n,this._capabilities=a,this.options=t,t.allowUnsafeEval||u.config({jitless:!0}),this.setRequestHandler(Lr,r=>(console.log("Received ping:",r.params),{})),this.setEventHandler("hostcontextchanged",void 0)}_assertInitialized(n){if(this._initializedSent)return;let a=`[ext-apps] App.${n}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(a);console.warn(`${a}. This will throw in a future release.`)}_assertHandlerTiming(n){if(!Cn.ONE_SHOT_EVENTS.has(n)||this._everHadListener.has(n)||(this._everHadListener.add(n),!this._initializedSent))return;let a=`[ext-apps] "${String(n)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(a);console.warn(a)}setEventHandler(n,a){a&&this._assertHandlerTiming(n),super.setEventHandler(n,a)}addEventListener(n,a){this._assertHandlerTiming(n),super.addEventListener(n,a)}onEventDispatch(n,a){n==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...a})}registerCapabilities(n){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._capabilities=V$(this._capabilities,n)}registerTool(n,a,t){if(this._registeredTools[n])throw Error(`Tool ${n} is already registered`);let r=this,o=()=>{r._initializedSent&&r._capabilities.tools?.listChanged&&r.sendToolListChanged()},s=a.inputSchema!==void 0,l={title:a.title,description:a.description,inputSchema:a.inputSchema,outputSchema:a.outputSchema,annotations:a.annotations,_meta:a._meta,enabled:!0,enable(){this.enabled=!0,o()},disable(){this.enabled=!1,o()},update(d){Object.assign(this,d),o()},remove(){r._registeredTools[n]===l&&(delete r._registeredTools[n],o())},handler:async(d,c)=>{if(!l.enabled)throw Error(`Tool ${n} is disabled`);let f;if(s){let g=l.inputSchema,_=g?await Gl(g,d??{},`Invalid input for tool ${n}: `):d??{};f=await t(_,c)}else f=await t(c);return l.outputSchema&&!f.isError&&(f.structuredContent=await Gl(l.outputSchema,f.structuredContent,`Invalid output for tool ${n}: `)),f}};return this._registeredTools[n]=l,!this._capabilities.tools&&!this.transport&&this.registerCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),o(),l}ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(n,a)=>{let t=this._registeredTools[n.name];if(!t)throw Error(`Tool ${n.name} not found`);return t.handler(n.arguments,a)},this.onlisttools=async(n,a)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([t,r])=>r.enabled).map(async([t,r])=>{let o={name:t,title:r.title,description:r.description,inputSchema:r.inputSchema?await Bl(r.inputSchema,"input"):{type:"object",properties:{}}};return r.outputSchema&&(o.outputSchema=await Bl(r.outputSchema,"output")),r.annotations&&(o.annotations=r.annotations),r._meta&&(o._meta=r._meta),o}))}))}async sendToolListChanged(n={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:n})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(n){this.setEventHandler("toolinput",n)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(n){this.setEventHandler("toolinputpartial",n)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(n){this.setEventHandler("toolresult",n)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(n){this.setEventHandler("toolcancelled",n)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(n){this.setEventHandler("hostcontextchanged",n)}get onteardown(){return this._onteardown}set onteardown(n){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,n),this._onteardown=n,this.replaceRequestHandler(ub,(a,t)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(a.params,t)})}get oncalltool(){return this._oncalltool}set oncalltool(n){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,n),this._oncalltool=n,this.replaceRequestHandler(rp,(a,t)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(a.params,t)})}get onlisttools(){return this._onlisttools}set onlisttools(n){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,n),this._onlisttools=n,this.replaceRequestHandler(np,(a,t)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(a.params,t)})}assertCapabilityForMethod(n){switch(n){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${n})`);break}}assertRequestHandlerCapability(n){switch(n){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${n})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${n} registered`)}}assertNotificationCapability(n){}assertTaskCapability(n){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(n){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(n,a){if(this._assertInitialized("callServerTool"),typeof n=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${n}"). Did you mean: callServerTool({ name: "${n}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:n},qr,{onprogress:()=>{},resetTimeoutOnProgress:!0,...a})}async readServerResource(n,a){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:n},ep,a)}async listServerResources(n,a){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:n},Qm,a)}async createSamplingMessage(n,a){this._assertInitialized("createSamplingMessage");let t=n.tools?sp:op;return await this.request({method:"sampling/createMessage",params:n},t,a)}sendMessage(n,a){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:n},ib,a)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,a){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:n},el,a)}openLink(n,a){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:n},eb,a)}downloadFile(n,a){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:n},tb,a)}requestTeardown(n={}){return this.notification({method:"ui/notifications/request-teardown",params:n})}requestDisplayMode(n,a){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:n},cb,a)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,a=0,t=0,r=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let s=document.documentElement,l=s.style.height;s.style.height="max-content";let d=Math.ceil(s.getBoundingClientRect().height);s.style.height=l;let c=Math.ceil(window.innerWidth);(c!==a||d!==t)&&(a=c,t=d,this.sendSizeChanged({width:c,height:d}))}))};r();let o=new ResizeObserver(r);return o.observe(document.documentElement),o.observe(document.body),()=>o.disconnect()}async connect(n=new ia(window.parent,window.parent),a){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1,await super.connect(n);try{let t=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:B$}},gb,a);if(t===void 0)throw Error(`Server sent invalid initialize result: ${t}`);this._hostCapabilities=t.hostCapabilities,this._hostInfo=t.hostInfo,this._hostContext=t.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(t){throw this.close(),t}}};D(Cn,"ONE_SHOT_EVENTS",new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]));var Rn=Cn;var hb="https://developers.tripo3d.ai/en/keys",$b="https://developers.tripo3d.com/zh/keys",K=e=>document.getElementById(e),Se=new Rn({name:"Tripo settings",version:"0.2.3"},{});async function dn(e,i={}){let n=await Se.callServerTool({name:`tripo_${e}`,arguments:i}),a=(n.content??[]).find(t=>t.type==="text")?.text??"";if(n.isError)throw new Error(a.replace(/^Error \[[A-Z_]+\]:\s*/,"")||"The call failed.");try{return JSON.parse(a)}catch{throw new Error(a||"The call returned nothing.")}}function Ee(e){for(let i of["save","clear","signin","region"])K(i).disabled=e;e||(K("clear").disabled=!$l||$l.key.source!=="store")}function he(e){let i=K("error");i.textContent=e??"",i.hidden=!e}var $l=null;function _l(e){$l=e;let i=K("account");if(e.signedIn){let n=[e.account??"Signed in"];e.region&&n.push(e.region==="cn"?"China mainland":"International"),typeof e.balance=="number"&&n.push(`${e.balance.toLocaleString()} credits`),i.textContent=n.join(" \xB7 "),i.dataset.state="ok"}else i.textContent="Not signed in. Save an API key or sign in with Tripo.",i.dataset.state="off";K("keystate").textContent=e.key.source==="env"?"Set by the TRIPO_API_KEY environment variable, which takes precedence over a saved key.":e.key.source==="store"?"A key is saved.":"No key is saved.",K("clear").disabled=e.key.source!=="store"}async function bl(){he(null);try{_l(await dn("auth_status"))}catch(e){he(e.message)}}async function bb(e){e.preventDefault();let i=K("apikey"),n=i.value.trim();if(!n){he("Enter an API key first.");return}Ee(!0),he(null);try{_l(await dn("set_key",{apiKey:n})),i.value=""}catch(a){he(a.message)}finally{Ee(!1)}}async function _b(){Ee(!0),he(null);try{_l(await dn("clear_key"))}catch(e){he(e.message)}finally{Ee(!1)}}var At=null;function mp(){At&&clearTimeout(At),At=null}async function yb(){mp(),Ee(!0),he(null);let e=K("region").value;try{let i=await dn("login_start",{region:e});if(!i.url){K("device").hidden=!0,await bl(),Ee(!1);return}K("code").textContent=i.code??"",K("open").onclick=()=>void Se.openLink({url:i.url}),K("device").hidden=!1,K("pollstate").textContent="Waiting for you to approve the code in your browser.",Se.openLink({url:i.url});let n=async()=>{let a;try{a=await dn("login_poll")}catch(t){a={state:"error",message:t.message}}if(a.state==="pending"){At=setTimeout(()=>void n(),i.pollAfterMs||5e3);return}At=null,Ee(!1),a.state==="done"?(K("device").hidden=!0,await bl()):(K("pollstate").textContent=a.state==="expired"?"The code expired. Sign in again for a new one.":"",a.state==="error"&&he(a.message??"Sign-in failed."))};At=setTimeout(()=>void n(),i.pollAfterMs||5e3)}catch(i){he(i.message),Ee(!1)}}function pp(e){e&&(e.theme&&lp(e.theme),e.styles?.variables&&dp(e.styles.variables),e.styles?.css?.fonts&&cp(e.styles.css.fonts))}Se.onhostcontextchanged=e=>pp({...Se.getHostContext(),...e});Se.onteardown=async()=>(mp(),{});K("keyform").addEventListener("submit",e=>void bb(e));K("clear").addEventListener("click",()=>void _b());K("signin").addEventListener("click",()=>void yb());K("getkey").addEventListener("click",e=>{e.preventDefault(),Se.openLink({url:K("region").value==="cn"?$b:hb})});Se.connect().then(()=>{pp(Se.getHostContext()),bl()}).catch(e=>he(`Could not reach the host: ${e.message}`));})();
178
178
  </script>
179
179
  </body>
180
180
  </html>
@@ -3,11 +3,27 @@
3
3
  This plugin runs tripo-cli 0.11.2, pinned in its package, so nothing needs installing. Every `tripo ...` command in the guide below is a call to `tripo(action="cli", args=[...])` with the words after `tripo` as the array: `tripo balance` is `tripo(action="cli", args=["balance"])`, and `tripo task get <id>` is `tripo(action="cli", args=["task","get","<id>"])`. The plugin adds `--json`, `--yes` and `--no-open` to every command and returns the parsed JSON result. Relative paths resolve against `<project>/Saved/Tripo`, so pass absolute paths.
4
4
 
5
5
  - Sign in with `tripo(action="cli", args=["login","--region","ov","--no-wait"])` (`cn` for the China site), or set `TRIPO_API_KEY` in the ue-mcp server environment. Then check with `tripo(action="cli", args=["doctor"])`.
6
- - To get a model into Unreal, use `tripo(action="generate", prompt="...")`. It runs `tripo make` with Unreal defaults (`--for anim`, a rig with `spec=unreal`, `convert:fbx`, `-p pbr=true`), writes to `<project>/Saved/Tripo/<name>` and imports the result with `asset(action="import_model")`. `dryRun=true` returns the plan and credit estimate. A pending result names the `generate(resume=...)` call that finishes the import.
6
+ - To get a model into Unreal, use `tripo(action="generate", prompt="...")`. It spends credits, so call it with `dryRun=true` first: the dry run returns the exact settings and the credit estimate for nothing, and the same call without `dryRun` generates. Without options it runs `tripo make` with `--model H3.1` (the cheapest model the CLI can price), GLB output, `-p pbr=true`, `--for anim` and a rig with `spec=unreal`. It never picks a premium model, `texture_quality=detailed` or `geometry_quality=detailed`; pass `model` or `params` for those, only when the user asks. `format="fbx"` adds `convert:fbx` as the last step, but the conversion has produced tiny scale and cracked meshes that the same task as GLB did not, so leave it off unless FBX is required. The raw GLB and `preview.png` are saved under the job folder, and the result lists their paths, the settings used, the credits and when Tripo's download links expire (about 8 days). The result imports the model with `asset(action="import_model")`; when that cannot run it still returns success with `status="generated"` and the `importCall` to make next. A pending result names the `generate(resume=...)` call that finishes the import.
7
+ - The estimate covers the generation step only. Rig, retarget, texture and convert steps are billed on top.
7
8
  - A model file already on disk goes straight to `asset(action="import_model", filePath=..., kind="skeletal")`.
8
9
  - The cli action stops a command after `timeoutSec` (default 300). For long jobs pass `--no-wait`, then `["task","watch","<id>","--download"]`. `tripo mcp` and `tripo update` are not available through the plugin.
9
10
  - Ignore the guide's install, `TRIPO_CLIENT_APP` and `TRIPO_DISTRIBUTION_CHANNEL` instructions; the plugin handles the binary.
10
11
 
12
+ ## Making turnaround images
13
+
14
+ A character turnaround goes to `tripo(action="generate", views={front: ..., left: ..., back: ..., right: ...})`, or to `images` with files named by view. Generate prepares the views first, and `tripo(action="prepare_images", views={...})` does the same for free so the files can be checked before credits are spent. Files go to the job folder as lossless PNGs named `front.png`, `left.png`, `back.png` and `right.png`, which is how the CLI reads each view; originals are never changed. `prepareImages=false` sends them as they are.
15
+
16
+ Marked (Tripo) are Tripo's own guidance; the rest is what the preparation step does or what the plugin recommends.
17
+
18
+ - Format and size (Tripo): PNG, at least 1024 px, about 1600 px on the long edge recommended, 256 px minimum, 20 MB maximum. Preparation refuses a view under 256 px or over 20 MB, and warns below 1024 px.
19
+ - Framing (Tripo): the subject at 70-85% of the frame, centered, with margin on every side. Check the margin on width, not only height, so the fingertips of a T-pose keep clear space. Preparation targets 75% in the limiting dimension and warns when a subject touches the source edge.
20
+ - Pose (Tripo): T-pose when rigging is the priority, A-pose for cloth. Use the same pose in every view, limbs separated from the torso, and a neutral face.
21
+ - Consistency (Tripo): the same canvas and scale in every view, head and feet aligned across views, left and right as true mirrors, and the same details in every view. Preparation applies one scale and one baseline to all views, which assumes the views were drawn at the same scale; it warns when their source sizes differ.
22
+ - Background and light (Tripo): a plain white or light gray background, even diffuse light, no cast or ground shadows, and a level camera, ideally orthographic.
23
+ - Views (Tripo): front is required, two views are the minimum and four are recommended. Name the files by view.
24
+ - Style: a stylized reference gives stylized output, but expect the texture to come back smoother.
25
+ - Checking results: inspect the raw GLB (the result's `glb` path) before any conversion. Change one variable at a time, and pass a fixed seed (`params=["model_seed=123"]`) to compare runs.
26
+
11
27
  ---
12
28
 
13
29
  # Tripo CLI Skill
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ue-mcp-tripo",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Tripo plugin for ue-mcp. Runs Tripo's own CLI to turn a prompt or image into a rigged, textured Unreal Engine 5 character imported through ue-mcp core, and exposes every other CLI command through a passthrough.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -51,6 +51,7 @@
51
51
  "node": ">=20"
52
52
  },
53
53
  "dependencies": {
54
+ "sharp": "^0.35.5",
54
55
  "tripo-cli": "0.11.2"
55
56
  }
56
57
  }
@@ -8,11 +8,27 @@ description: Generate, rig, animate, convert and import 3D models with Tripo thr
8
8
  This plugin runs tripo-cli 0.11.2, pinned in its package, so nothing needs installing. Every `tripo ...` command in the guide below is a call to `tripo(action="cli", args=[...])` with the words after `tripo` as the array: `tripo balance` is `tripo(action="cli", args=["balance"])`, and `tripo task get <id>` is `tripo(action="cli", args=["task","get","<id>"])`. The plugin adds `--json`, `--yes` and `--no-open` to every command and returns the parsed JSON result. Relative paths resolve against `<project>/Saved/Tripo`, so pass absolute paths.
9
9
 
10
10
  - Sign in with `tripo(action="cli", args=["login","--region","ov","--no-wait"])` (`cn` for the China site), or set `TRIPO_API_KEY` in the ue-mcp server environment. Then check with `tripo(action="cli", args=["doctor"])`.
11
- - To get a model into Unreal, use `tripo(action="generate", prompt="...")`. It runs `tripo make` with Unreal defaults (`--for anim`, a rig with `spec=unreal`, `convert:fbx`, `-p pbr=true`), writes to `<project>/Saved/Tripo/<name>` and imports the result with `asset(action="import_model")`. `dryRun=true` returns the plan and credit estimate. A pending result names the `generate(resume=...)` call that finishes the import.
11
+ - To get a model into Unreal, use `tripo(action="generate", prompt="...")`. It spends credits, so call it with `dryRun=true` first: the dry run returns the exact settings and the credit estimate for nothing, and the same call without `dryRun` generates. Without options it runs `tripo make` with `--model H3.1` (the cheapest model the CLI can price), GLB output, `-p pbr=true`, `--for anim` and a rig with `spec=unreal`. It never picks a premium model, `texture_quality=detailed` or `geometry_quality=detailed`; pass `model` or `params` for those, only when the user asks. `format="fbx"` adds `convert:fbx` as the last step, but the conversion has produced tiny scale and cracked meshes that the same task as GLB did not, so leave it off unless FBX is required. The raw GLB and `preview.png` are saved under the job folder, and the result lists their paths, the settings used, the credits and when Tripo's download links expire (about 8 days). The result imports the model with `asset(action="import_model")`; when that cannot run it still returns success with `status="generated"` and the `importCall` to make next. A pending result names the `generate(resume=...)` call that finishes the import.
12
+ - The estimate covers the generation step only. Rig, retarget, texture and convert steps are billed on top.
12
13
  - A model file already on disk goes straight to `asset(action="import_model", filePath=..., kind="skeletal")`.
13
14
  - The cli action stops a command after `timeoutSec` (default 300). For long jobs pass `--no-wait`, then `["task","watch","<id>","--download"]`. `tripo mcp` and `tripo update` are not available through the plugin.
14
15
  - Ignore the guide's install, `TRIPO_CLIENT_APP` and `TRIPO_DISTRIBUTION_CHANNEL` instructions; the plugin handles the binary.
15
16
 
17
+ ## Making turnaround images
18
+
19
+ A character turnaround goes to `tripo(action="generate", views={front: ..., left: ..., back: ..., right: ...})`, or to `images` with files named by view. Generate prepares the views first, and `tripo(action="prepare_images", views={...})` does the same for free so the files can be checked before credits are spent. Files go to the job folder as lossless PNGs named `front.png`, `left.png`, `back.png` and `right.png`, which is how the CLI reads each view; originals are never changed. `prepareImages=false` sends them as they are.
20
+
21
+ Marked (Tripo) are Tripo's own guidance; the rest is what the preparation step does or what the plugin recommends.
22
+
23
+ - Format and size (Tripo): PNG, at least 1024 px, about 1600 px on the long edge recommended, 256 px minimum, 20 MB maximum. Preparation refuses a view under 256 px or over 20 MB, and warns below 1024 px.
24
+ - Framing (Tripo): the subject at 70-85% of the frame, centered, with margin on every side. Check the margin on width, not only height, so the fingertips of a T-pose keep clear space. Preparation targets 75% in the limiting dimension and warns when a subject touches the source edge.
25
+ - Pose (Tripo): T-pose when rigging is the priority, A-pose for cloth. Use the same pose in every view, limbs separated from the torso, and a neutral face.
26
+ - Consistency (Tripo): the same canvas and scale in every view, head and feet aligned across views, left and right as true mirrors, and the same details in every view. Preparation applies one scale and one baseline to all views, which assumes the views were drawn at the same scale; it warns when their source sizes differ.
27
+ - Background and light (Tripo): a plain white or light gray background, even diffuse light, no cast or ground shadows, and a level camera, ideally orthographic.
28
+ - Views (Tripo): front is required, two views are the minimum and four are recommended. Name the files by view.
29
+ - Style: a stylized reference gives stylized output, but expect the texture to come back smoother.
30
+ - Checking results: inspect the raw GLB (the result's `glb` path) before any conversion. Change one variable at a time, and pass a fixed seed (`params=["model_seed=123"]`) to compare runs.
31
+
16
32
  ---
17
33
 
18
34
  # Tripo CLI Skill
package/ue-mcp.plugin.yml CHANGED
@@ -32,9 +32,10 @@ registry:
32
32
  tagline: Prompt or image to a rigged, textured Unreal character with Tripo
33
33
  description: >-
34
34
  Runs Tripo's own CLI from ue-mcp: one call generates a model, rigs it with
35
- Unreal Mannequin bone names, optionally adds a preset animation, converts
36
- it to FBX and imports it as a skeletal mesh. Every other CLI command is
37
- available through a passthrough.
35
+ Unreal Mannequin bone names, optionally adds a preset animation and
36
+ imports it as a skeletal mesh, with a credit estimate before anything is
37
+ spent. Turnaround images are prepared for multiview. Every other CLI
38
+ command is available through a passthrough.
38
39
  category: asset
39
40
  tags: [tripo, ai-3d, text-to-3d, image-to-3d, rigging, skeletal-mesh]
40
41
 
@@ -42,7 +43,9 @@ provides:
42
43
  tripo:
43
44
  description: >-
44
45
  Tripo AI 3D generation into Unreal, through the pinned tripo-cli.
45
- generate turns a prompt, image or task into an imported asset; cli runs
46
+ generate turns a prompt, image or task into an imported asset (run it
47
+ with dryRun=true first to see the cost); prepare_images readies
48
+ turnaround views for free; cli runs
46
49
  any tripo command (doctor, balance, task, anim, mesh, model, ...) and
47
50
  returns its JSON. Not signed in: ask the user to open the plugin's
48
51
  Settings in Studio, or sign in with
@@ -53,19 +56,28 @@ provides:
53
56
  effect: mutate
54
57
  visibility: [model] # the agent's; the settings view never spends credits
55
58
  description: >-
56
- Prompt, image(s) or task ref to an imported Unreal asset. Runs one
57
- `tripo make` with --for anim (rig=true, default) or --for game-pc,
58
- a --then chain of rig-check, rig (biped with spec=unreal), an
59
- optional retarget preset and convert:fbx, and -p pbr=true, writing
60
- to <project>/Saved/Tripo/<name>. Then imports the model with
61
- asset(import_model), kind=skeletal when rigged, static otherwise.
62
- Returns task ids, credits, the import result and its warnings. When
63
- make outlasts waitSec (or wait=false) it returns status=pending and
64
- the generate(resume=<jobDir>) call that finishes the import.
65
- dryRun=true returns the plan and credit estimate without spending.
59
+ Spends Tripo credits. Call it with dryRun=true first: that returns
60
+ the exact settings and the credit estimate for nothing, and the same
61
+ call without dryRun then generates. Prompt, image(s), turnaround views
62
+ or task ref to an imported Unreal asset. Runs one `tripo make` with
63
+ the cheapest priced model (H3.1) unless model is passed, GLB output,
64
+ and PBR, plus --for anim (rig=true, default) and a --then chain of
65
+ rig-check, rig (biped with spec=unreal) and an optional retarget
66
+ preset; convert:fbx runs last only for format=fbx. Output goes to
67
+ <project>/Saved/Tripo/<name>, with the raw GLB and preview.png saved
68
+ beside it. Every result lists the settings used and the credit
69
+ estimate, with the generation task ids and credits spent. The model
70
+ is then imported with asset(import_model), kind=skeletal when rigged,
71
+ static otherwise; if that import cannot run, the result is still
72
+ success with status=generated and the ready asset(import_model) call
73
+ to make next. When make outlasts waitSec (or wait=false) it returns
74
+ status=pending and the generate(resume=<jobDir>) call that finishes.
75
+ Turnaround views are prepared first; see prepare_images.
66
76
  schema:
67
77
  prompt: { type: string, description: "Text prompt" }
68
- images: { type: array, description: "Absolute image path(s) or URLs: one image, or 2 to 4 views" }
78
+ images: { type: array, description: "Absolute image path(s) or URLs: one image, or 2 to 4 views named front, left, back, right in the file name" }
79
+ views: { type: object, description: "Turnaround as a map of view to image path, e.g. {front: ..., left: ..., back: ...}. Front plus at least one other. Prepared before upload." }
80
+ prepareImages: { type: boolean, description: "Prepare multiview images before upload (default true); false sends the originals" }
69
81
  task: { type: string, description: "An existing Tripo task id (or @last / @name) to continue from" }
70
82
  rig: { type: boolean, description: "Rig and import as a skeletal mesh (default true)" }
71
83
  rigType: { type: string, description: "biped (default) | quadruped | hexapod | octopod | avian | serpentine | aquatic | others | auto (rig-check decides)" }
@@ -73,14 +85,14 @@ provides:
73
85
  animation: { type: string, description: "One preset animation, e.g. walk or preset:quadruped:walk" }
74
86
  retexture: { type: boolean, description: "Add a texture step first (for an untextured task ref)" }
75
87
  pbr: { type: boolean, description: "PBR textures (default true)" }
76
- format: { type: string, description: "fbx (default, adds convert:fbx) | glb" }
77
- model: { type: string, description: "Generation model, passed as --model" }
78
- params: { type: array, description: "Extra make -p key=value pairs, e.g. [\"face_limit=20000\"]" }
88
+ format: { type: string, description: "glb (default) | fbx (adds convert:fbx as the last step)" }
89
+ model: { type: string, description: "Generation model, passed as --model. Default H3.1, the cheapest the CLI can price; P2 and P1 only when asked" }
90
+ params: { type: array, description: "Extra make -p key=value pairs, e.g. [\"face_limit=20000\"]. Premium options such as texture_quality=detailed go here, only when asked" }
79
91
  then: { type: string, description: "Replace the whole --then chain" }
80
92
  name: { type: string, description: "Asset and job folder name (default from the prompt)" }
81
93
  wait: { type: boolean, description: "Default true; false returns pending at once" }
82
94
  waitSec: { type: number, description: "How long this call waits for make (default 300)" }
83
- dryRun: { type: boolean, description: "Plan and credit estimate only; nothing is spent" }
95
+ dryRun: { type: boolean, description: "Run this first. Returns the exact settings and the credit estimate; nothing is spent" }
84
96
  resume: { type: string, description: "jobDir from a pending result: wait for it and import" }
85
97
  destination: { type: string, description: "Content folder (default /Game/Tripo)" }
86
98
  kind: { type: string, description: "auto | static | skeletal (default skeletal when rigged)" }
@@ -95,6 +107,30 @@ provides:
95
107
  onConflict: { type: string }
96
108
  save: { type: boolean }
97
109
 
110
+ prepare_images:
111
+ task: tripo.prepare_images
112
+ effect: mutate
113
+ visibility: [model]
114
+ description: >-
115
+ Free. Prepares turnaround views for multiview generation without
116
+ calling Tripo, so the files can be inspected before credits are
117
+ spent. Flattens each view onto white, puts all of them on one square
118
+ canvas (default 1600 px) at one shared scale and baseline so heads
119
+ and feet line up, fills about 75% of the frame in its limiting
120
+ dimension, and writes PNGs named front, left, back and right to
121
+ <project>/Saved/Tripo/<name>/views. Originals are never modified.
122
+ Refuses a view under 256 px or over 20 MB and a turnaround without a
123
+ front view plus one other; warns below 1024 px and when a subject
124
+ touches the image edge. generate runs the same step on its own
125
+ multiview inputs.
126
+ schema:
127
+ views: { type: object, description: "Map of view to image path: front (required) plus at least one of left, back, right" }
128
+ images: { type: array, description: "Alternatively 2 to 4 files, named by view in the file name" }
129
+ name: { type: string, description: "Folder name under Saved/Tripo (default Turnaround)" }
130
+ outDir: { type: string, description: "Output folder instead of Saved/Tripo/<name>/views" }
131
+ canvas: { type: number, description: "Square canvas edge in pixels (default 1600)" }
132
+ fill: { type: number, description: "Share of the canvas the subject fills in its limiting dimension (default 0.75)" }
133
+
98
134
  cli:
99
135
  task: tripo.cli
100
136
  effect: mutate
@@ -161,6 +197,9 @@ tasks:
161
197
  tripo.generate:
162
198
  class_path: tasks/Generate
163
199
  description: "Prompt, image or task to an asset imported through core"
200
+ tripo.prepare_images:
201
+ class_path: tasks/PrepareImages
202
+ description: "Prepare turnaround views for multiview generation"
164
203
  tripo.cli:
165
204
  class_path: tasks/Cli
166
205
  description: "Run any tripo-cli command and return its JSON"