Skip to main content
Glama

generate_document

Generate documents in PDF, DOCX, or ODT format from HTML or Markdown content. Optionally apply templates, replace fields, and overlay a diagonal watermark.

Instructions

Generate a document with optional template, fields, and watermark.

Args: html_content: HTML content for the document body. markdown_content: Markdown content (alternative to HTML). template_name: Name of a pre-uploaded template (ODT/DOCX). fields: Template field replacements (key-value pairs). watermark: Diagonal watermark text overlay. output_format: Output format – PDF, DOCX, or ODT (default: PDF).

Returns: Base64-encoded document bytes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
html_contentNo
markdown_contentNo
template_nameNo
fieldsNo
watermarkNo
output_formatNoPDF

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

No annotations provided, so description must disclose behavior. It mentions that the tool generates a document and returns base64-encoded bytes. However, it does not state whether any state is modified, if authentication is required, or any rate limits. The stateless nature is implied but not explicit.

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?

The description is concise with a clear opening line and a list of parameters. It avoids redundancy but the list of args is necessary due to lack of schema descriptions. Could be more structured (e.g., separate sections for args and return).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers inputs and output, but misses stating that at least one of html_content, markdown_content, or template_name must be provided (though schema marks all optional). No examples or usage notes. Output schema exists, so return values are assumed covered.

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 has no descriptions (0% coverage), so the description fully compensates by explaining each parameter's purpose. However, it does not clarify constraints like mutual exclusivity of html_content and markdown_content, or that a template_name requires a pre-uploaded template.

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?

The description clearly states the tool generates documents with optional template, fields, and watermark. It lists inputs and output format. However, it does not differentiate from siblings like generate_pdf_from_html or generate_pdf_from_markdown, which perform similar tasks.

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

Usage Guidelines2/5

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

No guidance on when to use this tool vs alternatives. For example, it doesn't clarify that if only HTML to PDF is needed, generate_pdf_from_html might be more appropriate. No prerequisites or exclusions mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dokmatiq/docgen-sdks'

If you have feedback or need assistance with the MCP directory API, please join our Discord server