Skip to main content
Glama

draft_user_template

Render preview images of a user's PDF template so they can approve it BY LOOKING, before anything is saved.

THE POINT: a user wants their research in THEIR format — their masthead, colours,
layout, branding. A saved template is a BLUEPRINT: the author's stylesheet and
page chrome plus one markup pattern per content kind, which the backend applies
automatically to every PDF it renders for that user. A template is a visual
choice, so it is signed off by looking at rendered pages, never by describing
them. This is STEP 1 OF 2: it compiles the submitted HTML into a blueprint under
several treatments and renders each one as PNG previews of the platform's
SPECIMEN DOCUMENT — one of every content kind (title, lead, sections, bullets,
KPI cards, tables, charts, figure, source line, footnote). The user signs off on
how the design treats each kind of content, not on sample text. NOTHING IS
STORED — the draft lives in a 24-hour cache; `save_user_template` is step 2.

THE FLOW:
  1. Author the HTML with the user (or take the page they hand you).
  2. Call this, then poll `get_task_status(task_id)` until SUCCESS. Show the user
     EVERY variant's `preview_urls` (render the images
     inline where the client can; otherwise give the links) with its `name` and
     `rationale`, side by side.
  3. The user picks one -> `save_user_template(draft_id, variant_id)`. Never save
     a treatment the user has not seen and approved. Later changes go through
     `update_user_template`.

`template_type`:
  - "add_on"  — the previews are rendered at the 360pt column width the block
    will occupy inside a report — anything wider is clipped, not scaled — and
    the treatments restyle it to sit inside the host document (its own page
    background, masthead and disclaimer are stripped).
  - "bespoke" — the template drives the whole document: page chrome, stylesheet
    and the pattern for every content kind, previewed as full pages.

TEMPLATE RULES (violations come back as a 422 with `detail.errors`):
  - Real CSS engine: grid, flexbox, gradients, absolute positioning all work.
    Add `break-inside: avoid` to a panel that must not split across pages.
  - Only `data:` URIs for images. External images, stylesheets and web fonts are
    BLOCKED; <script>, <link> and similar are stripped.
  - HTML only, max 200 KB; must parse as HTML.

Asynchronous: returns {"task_id", "status": "PENDING", "next_step"}. Poll
`get_task_status(task_id)`; the finished result is {"draft_id", "variants":
[{"variant_id", "name", "rationale", "preview_urls": [...], "preview_pages"}],
"expires_in_seconds", "next_step", "warnings"} (or {"error", "warnings"} when the
draft failed). `preview_urls` are time-limited presigned PNG links, one per page.
Read `warnings`: a treatment that "changed too much" was dropped, and an empty
variant list means no usable adaptation survived — revise the template rather
than retrying the same one.

Runs a model pass plus a render per treatment, so expect minutes. Requires auth
(your MCP client attaches the OAuth bearer automatically). Rate-limited 30/min.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
anchorNoREQUIRED for add_on: the section it applies to, matched as a substring against the document's block keys (e.g. "technical", "financials", "ownership"). Omit for bespoke.
templateYesThe template as a complete HTML page in the intended style (max 200 KB; markdown is a 422). Its sample content is discarded at save — only structure and styling are kept.
template_typeYes"add_on" restyles ONE section of the standard report and keeps the rest; "bespoke" drives the whole document.

Output Schema

TableJSON 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.8/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=false and destructiveHint=false; the description adds far more: nothing is persisted (24h cache), async with PENDING task_id and polling, minutes of latency from a model pass plus per-treatment render, OAuth auth, 30/min rate limit, 422 error shape via detail.errors, and the meaning of warnings/empty variant lists. No contradiction with the annotations.

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 and organized with THE POINT / THE FLOW / TEMPLATE RULES headings, and nearly every sentence carries operational weight. It is on the long side, and the finished-result JSON shape partly duplicates the existing output schema, but the density is justified by the tool's complexity.

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?

Covers everything an agent needs for a complex, async, multi-step tool: the two-step workflow, polling requirement, template constraints, error and warning semantics, auth and rate limits, and the type-specific rendering behavior. Output schema exists, so return values are not the description's burden, yet the warnings interpretation is still supplied.

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 already 100%, but the description still adds real meaning: it explains the visual consequence of template_type ('add_on' renders at the 360pt column and clips rather than scales, stripping the host page chrome; 'bespoke' previews full pages), restates the anchor substring-matching requirement, and notes the 200KB/markdown-422 constraint on template.

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+resource+outcome: renders PNG previews of a user's PDF template so it can be approved visually before saving. It explicitly positions itself as 'STEP 1 OF 2' and names save_user_template as step 2, so an agent can distinguish it from the sibling save/update/get template tools without opening any schema.

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 an explicit numbered flow (author HTML -> call this -> poll get_task_status -> user picks -> save_user_template), names the alternatives (save_user_template, update_user_template, get_task_status) and the condition that selects each, and states an exclusion: never save a treatment the user has not seen.

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