Open in Studio
open_in_studioSave/publish the current kernelCAD model AND display it in one step: persists the project, returns the interactive Studio viewer (MCP Apps / ChatGPT outputTemplate), and includes a PNG preview in the SAME tool result (image content + previewUrl when available). Use this when the user wants to SEE or share the model — do NOT call get_latest_render afterwards for the happy path; the preview is already here when previewDelivered is true. Pass the full .kcad source as code (optional if you just called evaluate_script — omitting reuses that last evaluated source). Pass slug from a previous call to update the same project in place; omit slug only for a new separate model. Status fields: ok=true means publish succeeded (under CDN, meshStatus ready/building; ok=false + meshStatus=failed means hard mesh persist failure — do not claim the viewer is ready). previewDelivered=true means this result carries a displayable PNG — only then may you tell the user a preview was shown. meshStatus mirrors get_project (ready|building|failed|missing). Under CDN, heavy meshes may return meshStatus=building quickly while OCCT finishes; the embed retries meshUrl — do not wait or re-publish just for the mesh. Pass include_preview:false to skip the rasterizer (save + viewer URLs only). Trigger phrases: "open it in Studio", "let me see it", "show me the model"; also call after you finish a build and after each meaningful revision while iterating.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | The full .kcad source of the model to open in Studio (the script you have been editing). Optional: omit to reuse the source from your most recent evaluate_script call. | |
| slug | No | Slug returned by a previous open_in_studio call. When given, updates that existing project in place (live-updating the user's open Studio tab) instead of creating a new one. | |
| title | No | Optional human-readable title for the model (shown in Studio). Defaults to "Model from Claude". | |
| parameters | No | Optional list of the model's editable parameters, so Studio can render parameter controls. Each item is one control derived from the .kcad params. | |
| attachments | No | Complementary project files referenced by relative path from the .kcad source. | |
| include_preview | No | Default true: render an iso PNG preview into this same tool result (reuses the server render cache when this source was already rendered). Set false to skip rasterization and return save/viewer URLs only. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | Whether publish succeeded. Under CDN mode, false when mesh persist hard-failed (meshStatus:failed) — never ok:true with meshUrl silently omitted. | |
| url | No | The /p/<slug> Studio link for the model. | |
| slug | No | The project slug; pass it back to update this project in place. | |
| meshUrl | No | Revision-matched mesh artifact URL when available — prefer this over re-executing CAD in the embed. When meshStatus is building, this is the expected CDN URL (retry until ready). | |
| updated | No | True when an existing project was updated; false when a new one was created. | |
| version | No | Immutable Studio revision persisted by this call. Read it with get_project_revision using this slug and version. | |
| embedUrl | No | Read-only, chrome-free /embed/<slug> viewer URL — drop into an <iframe> to embed the live model in any site or widget (no login). Includes meshUrl when a revision mesh artifact is available. | |
| meshError | No | Sanitized persist/repair error when meshStatus is failed. | |
| meshStatus | No | ready | building | failed | missing — explicit CDN artifact state (never silently omit meshUrl under CDN mode). | |
| previewUrl | No | HTTPS URL of the PNG preview when storage signed successfully. | |
| assetHashes | No | ||
| previewHint | No | ||
| previewView | No | ||
| serverBuild | No | Deploy identity so connector vs server mismatch is observable. | |
| previewBytes | No | ||
| previewWidth | No | ||
| previewCached | No | ||
| previewHeight | No | ||
| previewStatus | No | included = PNG + URL; included_inline = PNG only; unavailable = save ok but no preview; skipped = include_preview:false. | |
| attachmentCount | No | ||
| previewDelivered | No | True when this result includes a displayable PNG (image content and/or previewUrl). Only then may the agent claim a preview was shown to the user. |