template_replace
Replace {{variable}} placeholders in DOCX files with provided values. Handles multiple placeholders per paragraph and split across runs; lists any missing variables in the result.
Instructions
批量替换 docx 文档中的 {{变量}} 模板占位符。variables 为 {变量名: 值} 映射;未提供值的变量保持原样并在 missing_vars 中列出。同段落多处占位符按从右到左应用保证坐标正确;跨 run 断裂的占位符也能正确替换。返回 {matched, replaced, missing_vars, applied}。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | 目标 .docx 文档绝对路径 | |
| variables | Yes | 模板变量映射,如 {"name": "张三", "date": "2026-08-26"} | |
| session_id | No | (建议)标注会话 ID(wait_for_annotations 返回)。窗口重载精确绑定该会话 |