set_template
Enable a Charming Template for people who can already read the source App, and optionally publish it in Charming's public Template directory so anyone can discover and copy it. Listed grants no access to the live source App or its data. Use this when the user wants independent copies or a public Template listing, not access to the live App. Each copy belongs to the signed-in visitor from creation. Optional listing fields are a patch: title, summary, content_markdown, category, cover fields, and gallery change only when supplied. Publishing with listed: true requires a nonblank resulting title and summary; every cover or gallery image needs nonblank alt text and must reference an image asset from this App. Pass listed: true to also mark it for discovery, or listed: false to unlist it. Omitting listed is a patch, not a reset: it leaves the current listed state exactly as it is (an already-listed app stays listed; a never-listed app stays unlisted), so re-affirming that an app is a template never surprises the owner by delisting it. Idempotent: calling with the same effective listed state as the current one returns the same URL without re-firing analytics. Anonymous apps cannot be made into templates; the app must be claimed first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | Template listing title; null clears it | |
| app_id | Yes | The app ID (UUID) to publish as a template | |
| listed | No | Whether to also list the app in Charming's public template directory for discovery. `true` lists it, `false` unlists it. Omit this to leave the current listed state untouched — it is NOT a default-false reset, so omitting it never unlists an already-listed app. | |
| gallery | No | Ordered screenshot records; null or an empty array clears the gallery | |
| summary | No | Template listing summary; null clears it | |
| category | No | Template listing category; null clears it | |
| cover_alt | No | Nonblank cover alt text; supply with cover_asset_key | |
| cover_caption | No | Optional cover caption; supply with cover_asset_key | |
| cover_asset_key | No | App asset key for the cover image; null removes the cover | |
| content_markdown | No | Long-form Template listing content; null clears it |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Indicates success. Errors arrive as content with isError:true. | |
| listed | Yes | Whether the app is currently listed in the public template directory, reflecting the ACTUAL resulting state — not necessarily the call's `listed` input, since an omitted `listed` leaves the prior state unchanged. A template can be copyable without being listed. | |
| message | Yes | Consequence copy the agent should surface verbatim to the user when reporting the change. Spells out that other people will get their own copy — the user's data is untouched — and, when listed, that strangers can discover it. | |
| advisories | No | Structured non-fatal advisories, including authoring issues and unread staff feedback responses. Each advisory.summary is also appended to the text content for the LLM path. | |
| public_url | Yes | Canonical `/templates/<handle>/<app-name>` Template page. The URL stays the same while the Template is listed or unlisted. Existing App readers can copy an unlisted Template; anyone can copy it when Listed. The original is never mutated. Free of write-capable `?t=` tokens. |