Write Dataview Fields
dataview.fields.writeInsert or delete a Dataview field in a note with customizable syntax and placement. Supports add/remove operations, key-value pairs, and multiple syntax types. Idempotent.
Instructions
Insert or remove a Dataview field in a single note. op:'add' inserts a key:: value field; syntaxType picks the rendering (full-line = own line; bracket = [key:: value]; paren = (key:: value)); insertAt chooses placement (start, end, afterFrontmatter) unless lineNumber is given for precise control. op:'remove' deletes every occurrence of key (optionally restricted to a single lineNumber or a Dataview scope). Idempotent — re-running with the same args converges on the same document state.
Operates on the session-active vault (see vault.current — selectable via vault.select) unless an explicit vaultPath argument is passed, which always wins.
Examples:
Example 1 — Add a full-line priority field after the frontmatter:
{
"op": "add",
"filePath": "Projects/Alpha.md",
"key": "priority",
"value": "high",
"syntaxType": "full-line",
"insertAt": "afterFrontmatter"
}Example 2 — Remove every occurrence of the status field from a note:
{
"op": "remove",
"filePath": "Projects/Alpha.md",
"key": "status",
"scope": "all"
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| changed | Yes | True if the tool altered vault state on this call; false if it was a no-op. | |
| target | Yes | The path or identifier the tool acted on. | |
| summary | Yes | Short human-readable summary of what happened. |