Skip to main content
Glama

upsert_document_template

DestructiveIdempotent

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

NameRequiredDescriptionDefault
keyYesShort handle of the template, unique per tenant
bodyNoBody text
nameYesName of the document template
activeNoWhether the entry is active
formatNoTemplate format: html (default) or docx
descriptionNoDescription of the document template
body_document_idNoID of the body document

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changed
    • addedInput schema / properties / active / description
      Added value: +"Whether the entry is active"
    • addedInput schema / properties / body / description
      Added value: +"Body text"
    • addedInput schema / properties / body_document_id / description
      Added value: +"ID of the body document"
    • addedInput schema / properties / description / description
      Added value: +"Description of the document template"
    • addedInput schema / properties / format / description
      Added value: +"Template format: html (default) or docx"
    • addedInput schema / properties / key / description
      Added value: +"Short handle of the template, unique per tenant"
    • addedInput schema / properties / name / description
      Added value: +"Name of the document template"
  2. First observed

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare destructiveHint=true, idempotentHint=true and readOnlyHint=false, so the mutation/safety profile is covered. The description adds real behavior beyond that: the body is validated before saving and unclosed {{#each}}/{{#if}} or unknown blocks are rejected with a line number, plus a clarification of how body_document_id is read from storage. It does not say what happens to an existing template's prior content or assets on replace.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the action and the validation rule, then the required/optional breakdown; nearly every sentence carries information. Some telegraphic fragments ('Required: key (short handle, unique per tenant), name, and the source —') and the closing 'Returns what the template expects' is vague enough to be wasted space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 7-parameter mutation tool with no output schema and full annotation coverage, the definition covers validation, source precedence, format, and placeholder conventions. The remaining gap is the return value ('Returns what the template expects' is not informative) and any note on what replacing an existing template discards.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the schema descriptions are thin ('Body text', 'ID of the body document'). The description adds genuine meaning: key is unique per tenant, body must be HTML WITH placeholders, body_document_id must be an already-uploaded .html file, format defaults to html, and the placeholder syntax including the image-after-'base64,' convention.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Create or replace a template', and 'upsert' semantics (replace-existing) are spelled out rather than implied. It does not name a sibling alternative (e.g. upsert_brevo_template or attach_template_asset) as a routing contrast, so it stops short of 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit conditional guidance: 'Prefer body_document_id for anything sizeable' with the reason (the template never passes through a model), and an exclusion, 'Do not inline images, that is what assets are for', which points at the asset workflow. No explicit statement of when to use this versus upsert_brevo_template or when not to upsert at all.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.