Skip to main content
Glama

Fill a template and print it

render_template

Fills a template with JSON data and prints it to PDF (a download link, valid 24 hours, and the edit link in the editor, where its template and data stay editable — until the person edits it on the page, which makes it a plain HTML document: then change its html). Either a gallery template (template_id from list_templates; without data it prints its sample) or your own template source. Send data in the shape of the template's sample (get_template). The language: read_guide topic "templates".

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "render_template"
  }
}

Input Schema

NameRequiredDescriptionDefault
dataNoThe values the template reads, in the shape of its sample data.
previewNoPictures (PNG) of pages come with the answer, so you can check the layout, fonts and images before giving the links. Default: true.
filenameNoThe PDF file name. Default: the template's name or the document's <title>.
templateNoYour own template source (HTML with {{ value }}, {% for %}, {% if %}), instead of template_id.
template_idNoA gallery template's id, from list_templates.
preview_pagesNoWhich pages to see, 1-based; -1 is the last page. Default: page 1 and the last page (a page that spilled over shows there). Up to 4, e.g. [1, 2, -1].

Output Schema

NameRequiredDescriptionDefault
urlYesThe link, valid 24 hours.
markYesWhether the PDF carries the ReflowPDF mark, and why.
bytesYes
guestYesPrinted without an account: the pages carry the ReflowPDF mark.
notesYesFacts about this PDF: how long its link works, its mark, what was not fetched or filled.
pagesYes
paperYesIts paper, e.g. "A4", "Letter", "210 × 99 mm"; empty when unknown.
titleYesThe document's title.
pdfUrlYesThe PDF (the same link as url).
sizeKbYesThe PDF's size in KB.
timingNoThe engine's own parts of it, when it states them: layoutMs (styles, layout and pagination) and writeMs (writing the PDF).
editUrlNoThe document in the ReflowPDF editor: the person edits it there (the link is the document; it lasts while it is used).
previewNoWhich pages came with this answer as pictures (PNG), or why none did.
filenameYes
previewsYesPages as pictures (PNG), kept with the PDF for its day.
renderMsNoHow long the print took on the server, in milliseconds (the engine and its adapter).
revisionNoIts revision: name it to update_document as base_revision.
expiresAtYesWhen the link stops working (ISO 8601).
documentIdNoThe document, for get_document and update_document.
missingFontsNoFont families the document named that no face answered: their text took the next family of its list.
missingVariablesNoTemplate values the data did not have (printed empty).
skippedResourcesNoImages, fonts or style sheets the server could not fetch.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changed
    • addedOutput schema / properties / guest
      Added value: +{
      +  "description": "Printed without an account: the pages carry the ReflowPDF mark.",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / paper
      Added value: +{
      +  "description": "Its paper, e.g. \"A4\", \"Letter\", \"210 × 99 mm\"; empty when unknown.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / pdfUrl
      Added value: +{
      +  "description": "The PDF (the same link as url).",
      +  "type": "string"
      +}
    • addedOutput schema / properties / previews
      Added value: +{
      +  "description": "Pages as pictures (PNG), kept with the PDF for its day.",
      +  "items": {
      +    "properties": {
      +      "height": {
      +        "type": "integer"
      +      },
      +      "page": {
      +        "type": "integer"
      +      },
      +      "url": {
      +        "type": "string"
      +      },
      +      "width": {
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "page",
      +      "url",
      +      "width",
      +      "height"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / sizeKb
      Added value: +{
      +  "description": "The PDF's size in KB.",
      +  "type": "integer"
      +}
    • addedOutput schema / properties / title
      Added value: +{
      +  "description": "The document's title.",
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "url",
      -  "expiresAt",
      -  "filename",
      -  "pages",
      -  "bytes",
      -  "mark",
      -  "notes"
      -]New value: +[
      +  "url",
      +  "expiresAt",
      +  "filename",
      +  "pages",
      +  "bytes",
      +  "mark",
      +  "notes",
      +  "title",
      +  "pdfUrl",
      +  "sizeKb",
      +  "paper",
      +  "guest",
      +  "previews"
      +]
  2. Changed1 schema field changed
    • addedOutput schema / properties / missingFonts
      Added value: +{
      +  "description": "Font families the document named that no face answered: their text took the next family of its list.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  3. Changed1 schema field changed
    • changedOutput schema / properties / notes / description
      Previous value: -"What to tell the person about this PDF."New value: +"Facts about this PDF: how long its link works, its mark, what was not fetched or filled."
  4. Changed3 schema fields changed
    • changedInput schema / properties / preview / description
      Previous value: -"A picture (PNG) of page 1 comes with the answer, so you can check the layout, fonts and images before giving the links. Default: true."New value: +"Pictures (PNG) of pages come with the answer, so you can check the layout, fonts and images before giving the links. Default: true."
    • addedInput schema / properties / preview_pages
      Added value: +{
      +  "description": "Which pages to see, 1-based; -1 is the last page. Default: page 1 and the last page (a page that spilled over shows there). Up to 4, e.g. [1, 2, -1].",
      +  "items": {
      +    "type": "integer"
      +  },
      +  "maxItems": 4,
      +  "type": "array"
      +}
    • changedOutput schema / properties / preview / description
      Previous value: -"What picture of the PDF came with this answer (page 1, as PNG), or why none did."New value: +"Which pages came with this answer as pictures (PNG), or why none did."
  5. Changed4 schema fields changed
    • addedInput schema / properties / preview
      Added value: +{
      +  "description": "A picture (PNG) of page 1 comes with the answer, so you can check the layout, fonts and images before giving the links. Default: true.",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / preview
      Added value: +{
      +  "description": "What picture of the PDF came with this answer (page 1, as PNG), or why none did.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / renderMs
      Added value: +{
      +  "description": "How long the print took on the server, in milliseconds (the engine and its adapter).",
      +  "type": "integer"
      +}
    • addedOutput schema / properties / timing
      Added value: +{
      +  "description": "The engine's own parts of it, when it states them: layoutMs (styles, layout and pagination) and writeMs (writing the PDF).",
      +  "properties": {
      +    "layoutMs": {
      +      "type": "number"
      +    },
      +    "writeMs": {
      +      "type": "number"
      +    }
      +  },
      +  "type": "object"
      +}
  6. First observed

TDQS

A4/5.0
Behavior5/5

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

Goes well beyond annotations (which only declare readOnly false, destructive false, non-idempotent, open-world). It discloses the 24-hour link expiry, that the editor link keeps template and data editable, and the important state transition where editing on the page turns the result into a plain HTML document requiring update to its html. That is exactly the kind of consequence an agent needs before committing to the call.

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

Conciseness3/5

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

One long run-on sentence stitched together with em-dashes and nested parentheticals, including a colon-chained clause about page editing. The purpose is front-loaded, but the middle section about editability is buried where it reads as an aside rather than a key caveat. It could be restructured into two or three short sentences without losing content.

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 six-parameter, nested, open-world tool with an output schema, this covers the purpose, the two input modes, defaults implied by omission, and the main lifecycle caveat. It does not address the case where both template and template_id are supplied, nor any auth or quota expectations, but with an output schema present nothing further is needed about return values.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3, and the description mostly restates it. It does add two pieces of meaning not in the schema: that omitting data falls back to the template's sample, and that template_id values come from list_templates while data must match get_template's sample. Useful cross-references, but no additional syntax or constraint detail.

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?

Opens with a specific verb+resource+output: "Fills a template with JSON data and prints it to PDF", then enumerates the artifacts (download link, 24h validity, editor edit link). It also distinguishes the two modes (gallery template via template_id vs your own template source), which separates it from render_pdf. The density of parentheticals makes the core statement harder to extract than it should be.

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 real routing guidance: template_id comes from list_templates, the data shape comes from get_template's sample, and the language is covered by read_guide topic "templates". It states the two mutually exclusive input modes and that omitting data prints the sample. It never explicitly contrasts with render_pdf or says when to prefer one over the other.

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.