document
This tool covers document CRUD, tree navigation, metadata, and daily-note oriented document operations.
When to read this page: you need to create, move, query, or convert documents.
Related pages:
Common Actions
| Group | Actions |
|---|---|
| Create and read | create, lookup, get_doc |
| Tree navigation | get_child_blocks, get_child_docs, list_tree, search_docs |
| Metadata and mutations | rename, move, remove, set_attr, duplicate |
| Daily note / conversion | create_daily_note, heading_to_doc, doc_to_heading |
Parameters and Semantics
createtakes either a human-readablepath, orparentPath+title; omitmarkdownto create an empty document. Preferpathfor child documents. TheparentPath+titlemode is supported, but MCP resolves the real document ID after creation because SiYuan may return a non-ID raw value for that endpoint.lookupresolves byid, storagepath, or human-readablehpath/hPath; useincludeto requestid,ids,path,hpath, ordocInfo.rename,remove, andmoveoften need a storage path if you are not using document IDs.get_child_docsrequires a documentid; it does not acceptnotebook + path.list_treeusesnotebook + path, andpathis a storage path such as/or/20240318112233-abc123.sy, not a human-readable path.- If bulk
removehits SiYuan's shortindexingwindow, retry by deleting one document at a time withnotebook + storage path. set_attrwrites document metadata attributes by document ID.
Safety Rules
removeandmoverequire explicit confirmation.- Always resolve document path type before mutating by path.
Examples
MCP:
json
{
"action": "create",
"notebook": "<notebook-id>",
"path": "/Inbox/Weekly Note",
"markdown": "# Weekly Report"
}json
{
"action": "lookup",
"id": "<doc-id>",
"include": "path"
}CLI:
bash
siyuan document create --notebook <notebook-id> --path "/Inbox/Weekly Note" --markdown "# Weekly Report"
siyuan document lookup --id <doc-id> --include pathAction List
createlookuprenameremovemoveget_child_blocksget_child_docsset_attrlist_treesearch_docsget_doccreate_daily_noteduplicateheading_to_docdoc_to_heading