set_frontmatter
Update or remove YAML frontmatter keys in an Obsidian note without altering its body.
Instructions
Mutate a note's YAML frontmatter without touching its body. Requires a readwrite API key.
Parses the existing frontmatter, merges in updates (overwriting matching
keys, adding any new ones), then drops keys listed in remove. The note
body is preserved byte-for-byte. If the note has no frontmatter (no ---
fence on line 1), a fresh block is prepended ahead of the unchanged body.
Re-serialization uses yaml.safe_dump(default_flow_style=False, sort_keys=False, allow_unicode=True). Caveat: PyYAML does NOT preserve
YAML comments — any # comment in the original frontmatter will be lost on
the first set_frontmatter call.
See get_vault_guide for vault frontmatter conventions.
Args: path: Vault-relative path to the note. updates: Mapping of keys to set. Use the empty dict (or omit) to skip. remove: List of keys to delete from the frontmatter. Missing keys are silently ignored.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| updates | No | ||
| remove | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |