Skip to main content
Glama

save_user_template

Idempotent

Save the user's PDF format — one template per account, applied automatically to every PDF the backend renders for them from now on.

STEP 2 OF 2 after `draft_user_template`. Two ways to call it:

SIGNED-OFF (the normal path): pass `draft_id` and the `variant_id` the user chose
from the previews. The EXACT treatment they looked at is stored — no second
adaptation pass that could produce something they never saw. `template`,
`template_type` and `anchor` are taken from the draft and may be omitted. A 404
means the draft expired (24h) or the variant does not exist: draft again.

DIRECT (no previews): pass `template` + `template_type` (+ `anchor` for an
add_on) — only when the user explicitly wants to skip the previews. An add_on
saved this way still gets an unreviewed harmonise pass, so prefer the signed-off
path for anything visual. HTML only: markdown is rejected with a 422.

ONE TEMPLATE PER USER — this is an UPSERT: saving replaces whatever was saved
before, with no history. Call `get_user_template` first and confirm with the user
before overwriting an existing format. To change a saved format afterwards, use
`update_user_template` (any field, or none to recompile it as stored).

WHAT CHANGES AFTERWARDS: the backend lays out this user's reports in the saved
format — every event-time report gets a copy in their template (get_latest_report
serves it, `template: "user"`), as do scheduled reports. The template is a blueprint (stylesheet, page chrome, one
pattern per content kind) applied to the document's own content: nothing is
filled in by hand, and no other call changes. When you compose a PDF yourself
from Flexreport data, `get_user_template` returns the markup to lay it out in.

Asynchronous: returns {"task_id", "status": "PENDING", "next_step"}. Poll
`get_task_status(task_id)`; the finished result is {"status": "SAVED",
"template_type", "anchor", "bytes", "patterns": [content kinds the design styles],
"tones": {positive | negative | neutral | accent: css class}, "warnings"}. Tell
the user which content kinds their design styles. A warning "keeping the
previously compiled blueprint" means the new compile was rejected and the
previous blueprint stays in force; the markup itself is still saved. Validation
failures are a 422 with `detail.errors` listing each problem.

Requires auth (your MCP client attaches the OAuth bearer automatically).
Rate-limited 100/min.

Input Schema

NameRequiredDescriptionDefault
anchorNoDirect path, add_on only (required there): the section it applies to, e.g. "technical".
draft_idNoSigned-off path: the draft_id from draft_user_template's finished task. Pass with variant_id.
templateNoDirect path only: the HTML template (markdown is a 422). Omit on the signed-off path — the draft supplies it.
variant_idNoSigned-off path: the variant_id the user chose from the previews. Pass with draft_id.
template_typeNoDirect path only (required there): "add_on" or "bespoke".

Output Schema

NameRequiredDescriptionDefault
statusYesTask state at dispatch, normally "PENDING".
changedNoupdate_user_template only: the fields that were updated.
task_idYesCelery task id; poll it with get_task_status for the result.
next_stepNoWhat the finished task returns.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Goes far beyond the annotations: discloses that this is an UPSERT with no history, that the signed-off path deliberately skips a second adaptation pass, that the call is asynchronous with a PENDING task_id and poll loop, and that a warning can leave the previous blueprint in force while the markup is still saved. Auth and rate limits (100/min) are also stated. Nothing here contradicts readOnlyHint=false, idempotentHint=true or destructiveHint=false.

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 upsert warning and step ordering, and the SIGNED-OFF / DIRECT / WHAT CHANGES AFTERWARDS headings make a long body scannable. It is longer than strictly necessary — the HTML-422 rule and the anchor rule are each stated twice, once narratively and again inside the schema descriptions.

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

Completeness5/5

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

For a zero-required-parameter, dual-mode, async, upsert mutation, the description covers everything an agent needs: mode selection, overwrite risk, async polling contract, terminal result fields (patterns, tones) with a directive to report content kinds to the user, warning interpretation, and the 422 error shape — even though an output schema also exists.

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

Parameters5/5

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

Although schema coverage is 100%, the description adds semantics the schema cannot: the parameters form two mutually exclusive call modes, and on the signed-off path template/template_type/anchor 'are taken from the draft and may be omitted'. It also scopes anchor to add_on only and states the HTML-only constraint that drives a 422.

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

Purpose5/5

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

States a specific verb and resource — saving the user's PDF format as a persistent, account-wide template — plus the scope ('one template per account, applied automatically to every PDF'). It distinguishes itself from draft_user_template (step 1), update_user_template (post-save change) and get_user_template (read-before-overwrite), so an agent can pick it out of a crowded sibling list.

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

Usage Guidelines5/5

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

Gives explicit branching instructions: the signed-off path (draft_id + variant_id) is 'the normal path', the direct path is 'only when the user explicitly wants to skip the previews', and add_on direct saves are discouraged because of the unreviewed harmonise pass. It also names prerequisites (call get_user_template and confirm before overwriting) and failure routes (404 → draft again).

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.

Resources