Create & edit templates
Over MCP, an agent can also create templates from a brief and edit existing ones: pages, groups and layouts, text, variables, conditions, repeats, page numbers. The result is an ordinary template that you can open in the editor, adjust, and print from your code.
How an agent builds a template
Section titled “How an agent builds a template”When the agent connects, the server explains how Imprime’s model fits together. A typical session then goes like this:
-
create_templatecreates a blank template in the format you asked for. To work on an existing one, the agent callslist_templatesandget_templateinstead. -
create_variabledeclares one variable per value that changes from one document to the next, with its type, required flag, max length and item fields. -
set_page_shapesdraws each page as a tree of groups with layouts, the way the layout recipe builds them: a page column, a header row, cards, a table repeated over a list. Every shape is validated, and the layout is computed exactly as the editor would compute it. -
set_page_numberingnumbers the pages, if you want them numbered. -
preview_templaterenders the template with sample values. The agent receives images of the PDF’s pages and looks for text out of its box, overlapping shapes or a misaligned column. It fixes what’s wrong withupdate_shape,add_shapesormove_shapes, and previews again. -
The agent gives you the preview link. Open it while signed in to Imprime to see the document and print it.
Each tool is listed in the tools reference.
Prompts that work
Section titled “Prompts that work”Create from a brief
Section titled “Create from a brief”Say what the document is for, its format, its sections, and which values change. A precise brief saves rounds of corrections:
Create an A4 portrait quote template called “Paper quote”, code QUOTE. Header: our name on the left, the quote number and date on the right. Then the client’s name and address in a card. Then a table of lines (description, quantity, unit price, amount) with the total under it. A footer with our legal mentions at the bottom of the page. Variables: clientName, clientAddress, quoteNumber, date, lines, total. Preview it with 4 sample lines.
Start from an existing document
Section titled “Start from an existing document”Attach a PDF or a screenshot of the document you produce today:
Recreate this invoice as an Imprime template. Keep the layout, turn the client details, the lines and the totals into variables, and preview it with the values of this example.
Edit a template
Section titled “Edit a template”Name the template and describe the change:
In “Paper quote”, add a discount line under the subtotal, shown only when a boolean
hasDiscountis true.
Number the pages of the catalog, “Page 2 of 5” at the bottom right, but not on the cover.
In the badge, the company name runs out of its box with long names: fix it.
Review it
Section titled “Review it”Ask the agent to push the template to its limits:
Preview the invoice with 12 lines and a 40-character client name. Does anything overflow?
Make variants
Section titled “Make variants”Duplicate the badge as “Staff badge”, with a green band and the ribbon saying STAFF.
Habits that keep templates safe
Section titled “Habits that keep templates safe”- For big changes, work on a copy. Ask the agent to duplicate the template first
(
duplicate_template), and switch your code to the copy once you’re happy with it. - Keep variable names stable. Your code sends values by name, so tell the agent which names must not change, or ask it to add variables instead of renaming them. Adding an optional variable never breaks your code. Adding a required one does, until your code sends it.
- Ask for limits. With max lengths on strings and max items on lists, values can’t outgrow the room the layout gives them, and the agent sizes boxes for the longest value.
- If you have the template open in the editor while the agent changes it, reload the page to see its work. Editing before reloading overwrites it.
- Agents are good at structure, but a last visual touch, such as a spacing or a color, is often quicker to do by hand in the editor.
Images and fonts
Section titled “Images and fonts”upload_imagestores a PNG or JPEG that the agent has as data. For your logo, it’s often simpler to add it in the editor yourself, then ask the agent to use it, or to leave an image box where it goes.list_fontsgives the agent every available family, built-in and imported, so you can name your brand’s font in the brief.
From design to production
Section titled “From design to production”With Claude Code, one session can go from the brief to the integration. The agent designs the template over MCP, previews it, then writes the code that prints it through the REST API. It already knows the template’s code and variable names, since it declared them.