assemble_per_record

assemble_per_record is a mail merge: it fills the same template once for every element of a JSON array and saves each result as its own file, named by a record field (fileNameField) or a running number. A bad record is listed, the rest are still written. Example prompt: “Write a welcome letter for every customer in customers.json, as PDFs named after the customer.”

Tool description (as the AI agent sees it):

Generates one document per record — a mail merge: a letter per customer, a certificate per attendee, an invoice per order — by filling the same template once for every element of a JSON array, and saves each result as its own file. Use it when the user wants separate documents for each row or record; use assemble_document for one document that lists all records. Templates: DOCX, DOC, RTF, ODT, TXT, Markdown, HTML, XLSX, PPTX, MSG, EML and more. Data: ‘dataJson’ (inline) or ‘data’ (a .json file) holding an array of objects, or an object with the array under ‘recordsPath’ (found automatically when the object has exactly one array). Each record is the template’s data for one document: its keys are the names the template uses («[Name]»), or name the record with ‘dataSourceName’ («[customer.Name]» → ‘customer’; worked out from the template when omitted). Files are named ‘