av
This tool covers attribute view and database-style operations.
When to read this page: you need to inspect or mutate a real SiYuan attribute view instead of using Markdown tables.
Related pages:
Common Actions
| Group | Actions |
|---|---|
| Read | get, render, get_attribute_view_keys, get_attribute_view_filter_sort, search, get_primary_key_values |
| Row operations | add_rows, remove_rows |
| Column operations | add_column, remove_column |
| Cell updates | set_cells |
| Structure | duplicate |
Parameters and Semantics
rendercan also create and materialize an AV whencreateIfNotExist=trueandblockIDis provided. In this mode,blockIDis the target parent/insertion context, and MCP inserts a SiYuan-style spun AV block through a transaction.- To render an existing AV, pass the AV ID as
id;renderdoes not accept theavIDparameter name used by write actions such asadd_rowsandset_cells. - Keep the
blockIDreturned byrender(createIfNotExist=true). Later AV reads and writes usually only needavID; MCP resolves the owning database block from row bindings, mirror database blocks, or the blocks-table AV block record. PassblockIDwhen you need an exact database-block view context, when multiple mirrors are possible, or as an explicit fallback for a brand-new empty AV. set_cellsis typed byvalueTypeand accepts either single-cell fields or acells/itemsarray.rowIDrefers to the row item ID, not the source block ID.- AV writes follow SiYuan frontend transaction operations where possible, including row/column/cell operations and database block
updatedrefresh metadata. duplicatefollows SiYuan's copy-as-mirror flow: it duplicates the AV definition, spins the AV block DOM, and inserts the mirror database block through a transaction.previousIDcontrols the insertion position when provided; otherwiseblockIDor an automatically resolved owning database block is used as the default insertion context.
Safety Rules
- AV operations are real database operations, not Markdown table edits.
- Use
avfor structured data instead of faking database behavior in Markdown.
Examples
MCP:
json
{
"action": "get",
"id": "<attribute-view-id>"
}json
{
"action": "add_column",
"avID": "<attribute-view-id>",
"keyName": "Status",
"keyType": "select"
}CLI:
bash
siyuan av get --id <attribute-view-id>
siyuan av add-column --av-id <attribute-view-id> --key-name Status --key-type select
siyuan av add-rows --av-id <attribute-view-id> --block-ids <block-id>
siyuan av add-rows --av-id <attribute-view-id> --primary-key-texts "Plain text row"Action List
getrenderget_attribute_view_keysget_attribute_view_filter_sortsearchadd_rowsremove_rowsadd_columnremove_columnset_cellsduplicateget_primary_key_values