ingest_docx
Converts .docx and .doc files into editable Docx-Flavored Markdown while preserving stored edits; set reset to rebuild from source and discard changes.
Instructions
攝入 .docx / .doc 文件,轉換為 DFM (Docx-Flavored Markdown) 格式。
同一份來源檔若已攝入過,會直接回傳既有文件狀態(保留所有已儲存/已 commit 的編輯與目前 revision),不會重新解析;只有 reset=True 才會明確捨棄所有編輯、 從來源檔重建(有其他 agent 持有有效租約時拒絕,並先備份)。
將 docx 解析為中間表示 (IR),再轉換為可在 VS Code 中編輯的 DFM 格式。 支援複雜元素:合併表格、圖表、頁首頁尾、巨集、目錄等。 支援舊版 .doc 格式(自動透過 LibreOffice 轉換為 .docx)。
輸出目錄結構:
data/{doc_id}/
├── content.dfm # 可編輯的 Markdown + YAML 標注
├── ir.json # 目前 IR(每次 save_docx 更新)
├── baseline_ir.json # ingest 時的不可變 IR(累積回寫的比對基準)
├── original.docx # 原始檔案備份(永不修改)
├── parts/ # 保留的 XML 零件
└── assets/ # 圖片和二進位資產Args: file_path: .docx 或 .doc 檔案的絕對路徑 reset: 若為 True,捨棄既有文件的所有編輯並從來源檔重新攝入
Returns: 攝入結果摘要(doc_id、區塊數量等)
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file_path": "<file_path>"
},
"name": "ingest_docx"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| reset | No | ||
| file_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |