Create or edit Library article
upsert_library_articleCreates a standalone draft article in Trainn Library, or edits an existing standalone article. Write a complete learner-facing article directly from the request; do not ask a generic topic, length, or formatting questionnaire unless a material fact is missing. Use semantic rich HTML (h1–h4, paragraphs, bold, italic, underline, strike, lists, blockquotes, links, tables, code, and verified HTTPS images when available); Trainn stores it as a structured Tiptap document. Never invent image or video URLs. Optional seo_description is the learner-facing summary, up to 500 characters; omit it on edit to keep the current summary, or pass an empty string to clear it. For richer teaching, position an inspected Library video, inspected Library guide, or verified YouTube video in body_html with , then define that name in embeds. Library embeds require the fresh selection_token from inspect_library_content. Use embeds only when the media materially helps the learner; never invent IDs or URLs. folder_id places a new article, or moves an existing one; omit it to use the Library root on create or to leave an existing article where it is. Creating does not publish. For edits, first inspect the current item and provide article_id plus expected_revision. Call publish_library_content only when the user explicitly asks to publish or add it to Library.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"idempotency_key": "<idempotency_key>",
"title": "<title>",
"body_html": "<body_html>"
},
"name": "upsert_library_article"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | ||
| embeds | No | Optional rich embeds. Each ref must appear exactly once in body_html as <trainn-embed data-ref="ref"></trainn-embed>. For library_video or library_guide, provide content_id and selection_token from inspect_library_content. For youtube, provide an HTTPS YouTube watch, short, or embed URL. | |
| body_html | Yes | ||
| folder_id | No | Library folder. On create, omit to use the Library root. On edit, omit to leave the article where it is. | |
| article_id | No | ||
| idempotency_key | Yes | ||
| seo_description | No | Learner-facing summary shown with the article. Omit on edit to keep the current summary. Pass an empty string to clear it. | |
| expected_revision | No |