upsert_document_template
Create or replace a template. The body is checked before saving: an unclosed {{#each}}/{{#if}} or an unknown block is rejected with its line number. Required: key (short handle, unique per tenant), name, and the source — either body (the HTML WITH placeholders) or body_document_id (an already uploaded .html file, read straight from storage). Prefer body_document_id for anything sizeable: the template never passes through a model that way, so a millimetre-positioned layout cannot be altered in transit. Do not inline images, that is what assets are for. Optional: format (html|docx, default html), description, active. Placeholders: {{variable}} for text, and for an image put its NAME directly after 'base64,' in the src — exactly the shape the existing hand-built process uses. Returns what the template expects.
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": {
"key": "<key>",
"name": "<name>"
},
"name": "upsert_document_template"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Short handle of the template, unique per tenant | |
| body | No | Body text | |
| name | Yes | Name of the document template | |
| active | No | Whether the entry is active | |
| format | No | Template format: html (default) or docx | |
| description | No | Description of the document template | |
| body_document_id | No | ID of the body document |