inject_directory_to_mindmap
Scans a directory tree, reads supported text files, and injects their contents as formatted nodes into a specified mindmap, handling all conversion automatically.
Instructions
Scan a directory, read file contents, and inject everything into a mindmap.
This is a one-shot tool: it scans the directory tree, reads each file's content, converts it to Quill Delta JSON (for .md/.markdown/.txt files), builds the full node hierarchy, and syncs it to the mindmap via sync_nodes.
The AI does NOT need to manipulate JSON — everything happens internally.
RECOMMENDED WORKFLOW:
Call tree_scope on the same path to get a reference count.
Call inject_directory_to_mindmap with the same path + id_mindmap.
Compare the returned summary (total_nodes, descriptions_filled) with the tree_scope count. If they match and errors is empty, the injection is validated — do NOT call get_mindmap to re-verify.
File handling by extension:
.md / .markdown → content converted via markdown_to_quill_delta()
.txt → content wrapped as plain text Quill Delta
.docx, .pdf, .xlsx, images, binaries, etc. → node created, description empty
Unknown extensions → node created, description empty
Files > 500 KB → node created, description empty (too large)
The 'descriptions' field on each node is a Quill Delta JSON string. Directory nodes (categories) never get descriptions — only file leaves do.
Args: root_path: absolute path to the directory to scan root_title: title for the root node (empty = use directory name) id_mindmap: target mindmap ID to inject the nodes into
Returns: JSON string with a summary: {"status": "success", "total_nodes": N, "descriptions_filled": N, "files_ignored": N, "total_desc_size_kb": N, "errors": [], "ignored_formats": [".docx", ".pdf", ...]}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| root_path | Yes | ||
| id_mindmap | No | ||
| root_title | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |