How to merge documents with AI agents using MCP
Leave feedback
On this page
Merging through an agent replaces the most-uploaded task on the internet with a local tool call. The documents stay on your machine; the combined file appears in your output folder.
Note
The commands and config snippets on this page are for the .NET build of the server — the only platform available today. Installation and client setup: MCP server for .NET. Other platforms will expose the same tools with their own launch command; everything else on this page applies unchanged.
The pattern
Put the documents in the storage folder the server can see.
Ask: “Merge part-one.pdf, part-two.pdf and appendix.pdf into one document, appendix last.”
The agent calls merge with the files in slots file1–file4.
The combined document appears in your output folder; the sources are untouched.
Order is the slot order
file1 comes first, file4 last. “Appendix last” is a positional instruction, and if the order matters, say it — an agent given three names in an arbitrary sentence may not infer the sequence you had in mind. Asking it to confirm the order before the call costs nothing.
More than four documents
One call takes four. For more, merge in rounds:
There are nine PDFs. Merge them four at a time, chaining each result into the next call, and tell me the final file name.
Round one merges files 1-4; round two merges that result with 5-7; round three adds the rest. The bookkeeping is exactly the kind of thing an agent does reliably — as long as you ask for the chaining explicitly.
Same format family
All PDFs, or all DOCX. A mixed set has no defined merge. When you have both:
Convert the Word files to PDF first, then merge everything.
That crosses two servers — GroupDocs.Conversion then Merger — which an agent with both registered handles in one conversation.
Check before you trust the result
Evaluation mode trims the result to three pages. A nine-document merge returning a three-page file is not a bug report, it is a licence check: