How to fill Word form fields from data with an AI agent

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Editor MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-editor -- dnx GroupDocs.Editor.Mcp --yes
Folders, licensing and more →

A Word form has named fields — text boxes, check boxes, drop-downs — and an agent that fills it by name fills it correctly. Run the GroupDocs.Editor MCP server locally: the agent reads the field names with get_form_fields, fills them with fill_form_fields, and the server reports any value it had no field for:

dnx GroupDocs.Editor.Mcp --yes

with GROUPDOCS_MCP_STORAGE_PATH pointing at your documents folder — or the Docker image, ghcr.io/groupdocs-editor/editor-net-mcp. Per-client config: Register in AI clients.

Fill new-employee-form.docx for Amara Okafor, amara.okafor@northwind.example, Finance, starting 1 December 2026; she agrees to the code of conduct. Her phone is +31 10 555 0100.

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.

Prerequisites

  • A Word form with legacy form fields — text, check box, drop-down, the kind Word inserts from Developer → Legacy Tools — in DOCX, DOC, DOCM, DOT, DOTX, RTF or ODT, in the storage folder. Content controls are not form fields to this server: get_form_fields returns "count": 0 for them.
  • The server registered in your AI client — quick start.

The calls

get_form_fields {"file":{"filePath":"new-employee-form.docx"}}
  -> {"count":6,"fields":[{"name":"FullName","type":"Text"},
       {"name":"Department","type":"DropDown","value":{"options":[...]}},
       {"name":"Agree","type":"CheckBox","value":false}, ...]}
fill_form_fields {"values":{"FullName":"Amara Okafor",
                            "Department":"Finance","Agree":"true",
                            "Phone":"+31 10 555 0100"}}
  -> "Updated 5 field(s) ... Not found: Phone.
      Saved to: .../new-employee-form_edited.docx"

What the agent sees

Captured from server 26.10.0 against a synthetic six-field form. The server prints the full path inside your storage folder; it is shortened to …/ here, and the evaluation line every response starts with is trimmed unless shown.

-> get_form_fields {"file":{"filePath":"new-employee-form.docx"}}
<- { "count": 6, "fields": [
     { "name": "FullName", "type": "Text", "value": "" },
     { "name": "Email", "type": "Text", "value": "" },
     { "name": "StartDate", "type": "Text", "value": "" },
     { "name": "Department", "type": "DropDown", "value": {
         "options": [ "Engineering", "Finance", "Sales", "Operations" ],
         "selected": "Engineering" } },
     { "name": "Agree", "type": "CheckBox", "value": false },
     { "name": "Newsletter", "type": "CheckBox", "value": false } ] }

-> fill_form_fields {"file":{"filePath":"new-employee-form.docx"},
     "values":{"FullName":"Amara Okafor",
               "Email":"amara.okafor@northwind.example",
               "StartDate":"2026-12-01","Department":"Finance",
               "Agree":"true","Phone":"+31 10 555 0100"}}
<- Updated 5 field(s) in 'new-employee-form.docx': FullName, Email,
   StartDate, Department, Agree.
   Not found: Phone. Call get_form_fields for the exact names.
   Saved to: …/new-employee-form_edited.docx

Reading the filled copy back returns "value": "Amara Okafor", "selected": "Finance", "Agree": true — and Newsletter still false, because nobody asked to tick it.

The form has no phone field. The server filled the five it knows and named the one it did not, so the agent can tell you the phone number is not on the form, rather than report a complete form.

One form per row

With a list of people — a CSV, a spreadsheet the agent reads with its own tools, a table pasted into the chat — the agent repeats fill_form_fields per row and names each copy:

Fill one copy of new-employee-form.docx for each row of new-hires.csv, named form-.docx, and list any column that has no field on the form.

outputName keeps the copies apart; without it they come out as new-employee-form_edited.docx, new-employee-form_edited (1).docx, … — impossible to tell apart without opening them.

Expected result

A filled copy per person, the original form untouched, and a list of values the form had no place for. The filled copy is written by the form-field engine, not through HTML, so the rest of the document — headers, footers, page numbers — stays as it was.

Troubleshooting

SymptomCauseFix
“Updated 0 field(s) … Not found: … No file was written.”the names are the labels on the page, not the field namescall get_form_fields first and use its name values
"count": 0the document has no form fields — just text and underscoresfill it with replace_text on a placeholder, or add fields in Word
A drop-down keeps its old valuethe value is not one of its optionspass one of the listed options exactly

FAQ

Which values does a check box take? "true" or "false".

Can it fill PDF forms? No — Word formats only. Convert the PDF first (turn a PDF into Word) or use a PDF form tool.

Can the filled copy be a PDF? Not in one step. A filled form is saved as a Word document — DOCX, DOC, DOCM, RTF, ODT; the server refuses "format": "pdf". Convert the filled copy afterwards, for example with GroupDocs.Conversion.

Does it fill content controls? No — only legacy form fields.

Add to your CLAUDE.md or AGENTS.md

Agents follow project instructions about when to use a tool. Paste this into the instruction file your agent reads (CLAUDE.md, AGENTS.md, .github/copilot-instructions.md, .cursorrules):

To fill Word forms in ./forms, call groupdocs-editor get_form_fields first and
fill by the exact names it returns; one outputName per person. Report every value
the server lists under 'Not found' instead of claiming the form is complete.

Honest limits

  • Evaluation mode: every edited document starts with an evaluation banner, a saved workbook gains an Evaluation Warning worksheet, only worksheets and slides 1–2 can be edited, and a PDF is edited two pages per call (replace_text refuses a longer PDF). Licensing.
  • One formatting run: replace_text does not see a phrase whose words are formatted differently — not on a second run either; use the HTML round-trip for those.
  • Word footers: replace_text, and extract_html without pagination, drop a Word document’s footer on server 26.10.0; content controls are flattened. What is kept.
  • No tracked changes: the edited copy carries the new text, not a redline.
  • PDF editing is a conversion: text and structure come across; exact page layout does not.

Read more