Skip to content

Tools reference

The server exposes 26 tools. Read-only ones are marked R; the others change your data.

Tool Arguments What it does
list_templates R — Your templates, most recently changed first
get_template R templateId Page size, variables and every page with its shape tree
create_template title, format, pageSize, code An empty template with one blank page
duplicate_template templateId, title, code A full copy, to start a variant safely
update_template templateId, title, code Rename, or change the code
delete_template templateId Delete it with its pages and variables

format is a4-portrait (1240 × 1754), a4-landscape (1754 × 1240) or 16:9 (1920 × 1080). Page size is chosen once, at creation.

Tool Arguments What it does
get_page R templateId, pageId One page — lighter than get_template
add_page templateId, position, visibleWhen, repeat, hidePageNumber A blank page
update_page templateId, pageId, visibleWhen, repeat, hidePageNumber Change its condition or repeat
move_page templateId, pageId, position Reorder
duplicate_page templateId, pageId A copy right after it
delete_page templateId, pageId Delete it (a template keeps one)
set_page_numbering templateId, pageNumbering Page numbers across the template
Tool Arguments What it does
set_page_shapes templateId, pageId, shapes Replace a page’s whole shape tree
add_shapes templateId, pageId, shapes, parentId, index Add shapes, keeping those already there
update_shape templateId, pageId, shapeId, patch Change some fields of one shape
move_shapes templateId, pageId, shapeIds, parentId, index Into a group, out of it, or restack
copy_shapes templateId, pageId, shapeIds, toPageId, toTemplateId Copy to another page or template
delete_shapes templateId, pageId, shapeIds Delete shapes
Tool Arguments What it does
create_variable templateId, name, type, default, required, maxLength, maxItems, itemFields Declare one
update_variable templateId, variableId, + the same fields Change its declaration
delete_variable templateId, variableId Delete an unused one

Types are string, boolean, image and object-list — see Variable types. Shapes refer to a variable by _id, while values at export time are given by name.

Tool Arguments What it does
upload_image dataUrl, name Store a PNG or JPEG, returns its _id
get_image R imageId Its natural size and type
list_fonts R — The font families a text run can use
Tool Arguments What it does
preview_template templateId, variableValues, seePages, imageWidth Renders the pages as images, plus a link

preview_template draws the template exactly as its PDF would be. The agent looks at the returned images to check its work — overlapping shapes, text running out of its box — then fixes and previews again. Its warnings say what did not fit on a page.

{
"templateId": "6ada52d12b452e53f3c518e3",
"variableValues": {
"client": "ACME Corp",
"discount": true,
"lines": [{ "label": "A5 flyers", "price": "$85" }]
}
}

The link it returns is where you view the document and print it from.