# assemble_document The assemble_document MCP tool fills a Word, Excel, PowerPoint, Markdown, HTML or e-mail template with JSON, XML, CSV or spreadsheet data and saves the document — tables, charts, images and barcodes included — locally. `assemble_document` fills a template with data and saves the result — a contract, invoice, letter or report — in the template's format or another (`format: "pdf"`). The data is inline JSON the agent writes (`dataJson`) or a file (`data`: JSON, XML, CSV, or a spreadsheet/Word/presentation table). Example prompt: *"Fill contract-template.docx for Contoso Pharma and save it as a PDF."* **Tool description (as the AI agent sees it):** > Generates a document from a template and data: fills the template's <<[field]>>, <>, <>, table, chart, image and barcode tags with values and saves the result — a contract, invoice, letter, report or e-mail built from a Word, Excel, PowerPoint, Markdown, HTML or e-mail template. Use it whenever the user asks to generate, fill in, populate or produce a document from a template. Templates: DOCX, DOC, RTF, ODT, TXT, Markdown, HTML, XLSX, XLS, ODS, PPTX, PPT, ODP, MSG, EML and more. Data: pass 'dataJson' (a JSON object or array, inline) or 'data' (a .json, .xml, .csv/.tsv file, or a spreadsheet, Word or presentation document whose table is the data). A JSON object's keys are the names the template uses ({"customer":{…},"items":[…]} fills <<[customer.Name]>> and <>); an array, XML, CSV or table is given the name the template uses for it automatically, or pass 'dataSourceName'. Call get_template_fields first to see which names and fields a template expects and a JSON skeleton to fill. Output: the template's own format by default; set 'format' (e.g. pdf, docx, html, md) to save it as another format of the same family, or as PDF. Do NOT pre-check whether files exist — just pass the filename the user provided; a file that cannot be found returns the list of available files instead. Returns 'Assembled …' with the saved path ('Saved to: …') of '