Skip to main content
Glama

Generate document

generate_document

Use this after reading the field schema, to fill published fields and return markdown plus a download link. Do not invent clause text. Call it once per document: the result always includes the markdown text, download_url is the file in the requested format, and editable_download_url is a Word copy the user can edit. Answers are short values for the published fields; unknown keys, overlong values, and choices outside a field's options are rejected with instructions for fixing them.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugYesTemplate slug from list_templates.
formatNopdf, docx, odt, or markdown. The download link uses this format.pdf
answersNoMap of field keys to values, using only keys from get_template_fields. Leave out keys you cannot answer; they stay as placeholders. Do not send placeholder text. Dates are YYYY-MM-DD. Use __omit__ to remove a placeholder.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugYes
titleYes
formatYes
answersYesAnswers as printed. ISO dates are written out in full.
filenameYes
markdownYesFilled template text for summarization. The file the user downloads is at download_url.
warningsNoAnswers that were accepted but look wrong. Fix and regenerate, or pass each warning on to the user.
download_urlYesAbsolute URL that downloads the rendered PDF, Word, ODT, or Markdown file.
unfilled_fieldsNoField keys still shown as placeholders in the document. Tell the user these need completing before the document is used.
editable_download_urlYesAbsolute URL for a Word (.docx) copy the user can edit before signing. Give it to the user with download_url.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • removedInput schema / properties / email
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "description": "Optional contact email recorded with the generation."
      -}
    • changedInput schema / properties / format / description
      Previous value: -"pdf, odt, or markdown. The download link uses this format."New value: +"pdf, docx, odt, or markdown. The download link uses this\nformat."
    • changedOutput schema / properties / download_url / description
      Previous value: -"Absolute URL that downloads the rendered PDF, ODT, or Markdown file."New value: +"Absolute URL that downloads the rendered PDF, Word, ODT, or Markdown file."
    • addedOutput schema / properties / editable_download_url
      Added value: +{
      +  "description": "Absolute URL for a Word (.docx) copy the user can edit before signing. Give it to the user with download_url.",
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "slug",
      -  "title",
      -  "format",
      -  "filename",
      -  "markdown",
      -  "download_url",
      -  "answers"
      -]New value: +[
      +  "slug",
      +  "title",
      +  "format",
      +  "filename",
      +  "markdown",
      +  "download_url",
      +  "editable_download_url",
      +  "answers"
      +]
  2. Changed6 schema fields changed
    • changedInput schema / properties / answers / description
      Previous value: -"Map of field keys to values. Missing keys stay as\nplaceholders."New value: +"Map of field keys to values, using only keys from\nget_template_fields. Leave out keys you cannot answer; they\nstay as placeholders. Do not send placeholder text. Dates\nare YYYY-MM-DD. Use __omit__ to remove a placeholder."
    • changedInput schema / properties / format / description
      Previous value: -"pdf, odt, or markdown."New value: +"pdf, odt, or markdown. The download link uses this format."
    • removedOutput schema / additionalProperties
      Removed value: -true
    • addedOutput schema / description
      Added value: +"Filled template text plus a link to the rendered file."
    • addedOutput schema / properties
      Added value: +{
      +  "answers": {
      +    "additionalProperties": {
      +      "type": "string"
      +    },
      +    "description": "Answers as printed. ISO dates are written out in full.",
      +    "type": "object"
      +  },
      +  "download_url": {
      +    "description": "Absolute URL that downloads the rendered PDF, ODT, or Markdown file.",
      +    "type": "string"
      +  },
      +  "filename": {
      +    "type": "string"
      +  },
      +  "format": {
      +    "type": "string"
      +  },
      +  "markdown": {
      +    "description": "Filled template text for summarization. The file the user downloads is at download_url.",
      +    "type": "string"
      +  },
      +  "slug": {
      +    "type": "string"
      +  },
      +  "title": {
      +    "type": "string"
      +  },
      +  "unfilled_fields": {
      +    "description": "Field keys still shown as placeholders in the document. Tell the user these need completing before the document is used.",
      +    "items": {
      +      "type": "string"
      +    },
      +    "type": "array"
      +  },
      +  "warnings": {
      +    "description": "Answers that were accepted but look wrong. Fix and regenerate, or pass each warning on to the user.",
      +    "items": {
      +      "type": "string"
      +    },
      +    "type": "array"
      +  }
      +}
    • addedOutput schema / required
      Added value: +[
      +  "slug",
      +  "title",
      +  "format",
      +  "filename",
      +  "markdown",
      +  "download_url",
      +  "answers"
      +]
  3. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare the safety profile (readOnlyHint=false, idempotentHint=false, destructiveHint=false); the description adds substantial context beyond them: the return payloads (markdown, download_url, editable_download_url) and their meaning, and the validation behavior (unknown keys, overlong values, and out-of-option choices are rejected with fix instructions). The 'once per document' note is also consistent with idempotentHint=false, giving the agent a reason for that annotation.

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?

It is front-loaded with the primary purpose and prerequisite, then layers the no-invention rule, cardinality, and return shape. The final sentence on validation is dense but earns its place by warning the agent about failure modes; nothing is padding, though the output descriptions are slightly redundant given an output schema exists.

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?

For a three-parameter generation tool with an output schema and annotations, the description covers prerequisite ordering, required input shape, validation failure behavior, and the identity of each returned artifact. An agent has everything needed to invoke it correctly on the first attempt.

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 coverage is 100%, so the baseline is 3, but the description adds genuine constraint semantics not in the schema: answers must be 'short values for the published fields', and invalid keys/values are rejected with remediation instructions. It doesn't restate format enum details already covered by the schema, which is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb and resource ('fill published fields and return markdown plus a download link') and explicitly positions the tool after 'reading the field schema', which distinguishes it from the sibling get_template_fields. An agent can tell immediately this is the terminal generation step, not a lookup.

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?

It states sequencing ('use this after reading the field schema') and a cardinality rule ('call it once per document'), plus a negative instruction ('do not invent clause text'). What is missing is any explicit statement of when NOT to use it or which sibling to prefer under ambiguous conditions, but the ordering guidance is clear.

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.