Hello David Wong •,
This behavior is understandable because agent-driven manipulation of an uploaded DOCX template is not currently the
most reliable pattern for production document generation.
The recommended approach is:
- Use the agent to extract the required information from the source document and return it as structured fields.
- Pass those fields to a Power Automate or agent flow.
- Use Word Online (Business) → Populate a Microsoft Word template to populate supported Content Controls.
- Save the generated DOCX to SharePoint or OneDrive and return its link to the user.
The Word Online connector supports plain text, dropdown, combo box, image, and repeating-section controls. It does not support every Content Control type, and its input template has a 10 MB limit.
Retrieving a DOCX through SharePoint MCP is useful for locating documents and extracting their text or metadata, but it should not be relied upon to retrieve the binary file and reconstruct or modify the original DOCX package. This explains the inconsistent Base64, binary-stream, and permission-related responses.
Other available options are:
- Document output (preview): Supports generating a Word document from a predefined layout, but uses {{fieldName}} placeholders rather than existing Word SDTs.
- Microsoft 365 structured document generation: Suitable for governed SharePoint-based templates and form-driven document creation.
- Custom API or Azure Function: Appropriate when unsupported Content Controls, advanced formatting, or direct Open XML manipulation is required.
Therefore, for the current scenario, the most robust design is:
Copilot Studio agent → extract structured data → Power Automate/agent flow → populate the Word template → save to SharePoint/OneDrive → return the completed document link.
Reference:
1.https://learn.microsoft.com/en-us/connectors/wordonlinebusiness/
2.https://learn.microsoft.com/en-us/microsoft-copilot-studio/mcp-word-tools
3.https://learn.microsoft.com/en-us/microsoft-copilot-studio/generate-document-output-prompt
4.https://learn.microsoft.com/en-us/microsoft-365/documentprocessing/automate-document-generation?view=o365-worldwide
5.https://learn.microsoft.com/en-us/sharepoint/copilot-in-sharepoint-structured-document-generation