Skip to content

fs Tool

Use fs first for ordinary document file operations. It accepts human-readable workspace paths and hides notebook IDs, block IDs, and storage paths.

Path shape:

  • /<notebook name> for a notebook root
  • /<notebook name>/<folder>/<doc> for a document
  • / for all readable notebook roots

Common Actions

ActionPurpose
lsList direct child documents as { name, path, children }
treeList a compact recursive document tree
readRead a document as Markdown
writeCreate a document, or replace its body with overwrite=true
searchSearch Markdown lines under a document or folder path

High-risk Actions

  • rm deletes a document and requires explicit confirmation.
  • mv moves or renames a document and requires explicit confirmation.

Examples

json
{ "action": "ls", "path": "/Inbox/Meetings" }
json
{ "action": "read", "path": "/Inbox/Meetings/2024 Summary" }
json
{ "action": "write", "path": "/Inbox/Meetings/New Doc", "markdown": "# Notes\n\nContent" }
json
{ "action": "search", "path": "/Inbox/Meetings", "query": "budget", "caseSensitive": false }

Use document, block, search, or av only when you need SiYuan-specific block layout, metadata, SQL, backlinks, assets, or database operations.

Released under the MIT License.