Skip to main content
Glama

Preview template PDF

render_dsl_preview
Read-onlyIdempotent

Render a DSL template + data to a preview PDF. Free (no credits), always watermarked 'PREVIEW — NOT FOR USE'. Returns JSON metadata plus the PDF bytes as an embedded base64 resource. No artifact is recorded, so there is no download URL or resource link. Mirrors POST /api/v1/preview.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "dsl": "<dsl>"
    },
    "name": "render_dsl_preview"
  }
}

Input Schema

NameRequiredDescriptionDefault
dslYesThe template source: a builder DSL script that assigns `const template = doc(...)` and optionally `const sampleData = {...}`.
dataNoOptional binding data. Falls back to the script's sampleData when omitted.
titleNoDocument title written to the PDF metadata. PDF viewers show it in the window title instead of the file name. When omitted, the title is 'Document'; a title set in the DSL's doc() is not used.

Output Schema

NameRequiredDescriptionDefault
renderMsYesServer-side render time in milliseconds.
pageCountYesPages in the rendered PDF.
sizeBytesYesSize of the PDF in bytes.
templateWarningsYesProblems found while binding data (unsupported expressions, unknown filters, bad currency codes, invalid chart data, …). Unresolved expressions render as empty text and bad chart data affects the chart. Each originates in the DSL or the data.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / dsl / description
      Previous value: -"The template source: a builder DSL script that assigns `const template = doc(...)` and optionally `const sampleData = {...}`. The builder functions are documented in the pdf-template-author skill; run validate_dsl on the script first."New value: +"The template source: a builder DSL script that assigns `const template = doc(...)` and optionally `const sampleData = {...}`."
    • changedOutput schema / properties / templateWarnings / description
      Previous value: -"Problems found while binding data (unsupported expressions, unknown filters, bad currency codes, invalid chart data, …). Unresolved expressions render as empty text and bad chart data affects the chart; fix them in the DSL or the data."New value: +"Problems found while binding data (unsupported expressions, unknown filters, bad currency codes, invalid chart data, …). Unresolved expressions render as empty text and bad chart data affects the chart. Each originates in the DSL or the data."
  2. Changed2 schema fields changed
    • changedInput schema / properties / title / description
      Previous value: -"Document title written to the PDF metadata. PDF viewers show it in the window title instead of the file name."New value: +"Document title written to the PDF metadata. PDF viewers show it in the window title instead of the file name. When omitted, the title is 'Document'; a title set in the DSL's doc() is not used."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "description": "Render metadata. The PDF itself is the embedded resource in `content`.",
      +  "properties": {
      +    "pageCount": {
      +      "description": "Pages in the rendered PDF.",
      +      "type": "integer"
      +    },
      +    "renderMs": {
      +      "description": "Server-side render time in milliseconds.",
      +      "type": "integer"
      +    },
      +    "sizeBytes": {
      +      "description": "Size of the PDF in bytes.",
      +      "type": "integer"
      +    },
      +    "templateWarnings": {
      +      "description": "Problems found while binding data (unsupported expressions, unknown filters, bad currency codes, invalid chart data, …). Unresolved expressions render as empty text and bad chart data affects the chart; fix them in the DSL or the data.",
      +      "items": {
      +        "properties": {
      +          "code": {
      +            "description": "Warning kind, e.g. 'unknown-filter'.",
      +            "type": "string"
      +          },
      +          "detail": {
      +            "description": "Human-readable explanation, when available.",
      +            "type": "string"
      +          },
      +          "expression": {
      +            "description": "The expression source that failed.",
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "code",
      +          "expression"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "pageCount",
      +    "sizeBytes",
      +    "renderMs",
      +    "templateWarnings"
      +  ],
      +  "type": "object"
      +}
  3. Changed2 schema fields changed
    • changedInput schema / properties / dsl / description
      Previous value: -"The builder DSL script."New value: +"The template source: a builder DSL script that assigns `const template = doc(...)` and optionally `const sampleData = {...}`. The builder functions are documented in the pdf-template-author skill; run validate_dsl on the script first."
    • changedInput schema / properties / title / description
      Previous value: -"Optional document title (shown in PDF metadata)."New value: +"Document title written to the PDF metadata. PDF viewers show it in the window title instead of the file name."
  4. First observed

TDQS

A3.9/5.0
Behavior4/5

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

The description adds substantial behavior beyond the annotations: it is free (no credits), always watermarked, records no artifact, and returns PDF bytes as embedded base64 with no download URL. These are exactly the operational facts an agent needs. It does not discuss error cases or size limits, keeping it from a 5.

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

Conciseness5/5

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

Four tight sentences, front-loaded with the core action, then constraints and return shape. Zero filler and nothing redundant with the schema.

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?

Even though an output schema exists, the description crisply explains the unusual return mechanism (base64 PDF with no URL) that a generic output schema would not convey. Combined with the watermark and no-artifact caveats, an agent has everything needed to call and interpret it correctly.

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 schema already documents dsl, data, and title thoroughly, including the sampleData fallback and title precedence rules. The description adds no parameter-level meaning, which is acceptable given the full schema, so the baseline 3 applies.

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?

States a specific verb and resource: render a DSL template plus data into a preview PDF. The 'preview' framing implicitly separates it from render_template, and the watermarked/free notes reinforce that this is not a production render. It stops short of naming the sibling it differs from.

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

Usage Guidelines3/5

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

Usage context is implied rather than stated: free, watermarked, no artifact recorded all signal 'use this to preview, not to produce output.' However, it never explicitly says when to choose this over render_template or get_render_download_url, leaving the agent to infer the alternative.

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