Generate document
generate_documentUse 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.
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": {
"slug": "<slug>"
},
"name": "generate_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes | Template slug from list_templates. | |
| format | No | pdf, docx, odt, or markdown. The download link uses this format. | |
| answers | No | Map 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
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes | ||
| title | Yes | ||
| format | Yes | ||
| answers | Yes | Answers as printed. ISO dates are written out in full. | |
| filename | Yes | ||
| markdown | Yes | Filled template text for summarization. The file the user downloads is at download_url. | |
| warnings | No | Answers that were accepted but look wrong. Fix and regenerate, or pass each warning on to the user. | |
| download_url | Yes | Absolute URL that downloads the rendered PDF, Word, ODT, or Markdown file. | |
| unfilled_fields | No | Field keys still shown as placeholders in the document. Tell the user these need completing before the document is used. | |
| editable_download_url | Yes | Absolute URL for a Word (.docx) copy the user can edit before signing. Give it to the user with download_url. |