Change a document of any type
update-documentModify fields of any Foundry VTT document using dotted paths or merge rules, with dry-run preview and rollback-safe changes.
Instructions
Generic fallback: change fields of one document of any type. changes follows Foundry's update rules: keys may be dotted paths, an object merges into the object that is there, lists and other values replace it. A list position in a key ("system.skills.2.value") changes only that entry. replace names keys of changes whose object replaces the stored object instead of merging; remove names paths to delete. The answer is the change as read back from Foundry, and what was stored differently. Ids, ownership, _stats, the type, embedded collections, the flags of this module and what a specialised tool guards (active scene, playback, chat recipients, macro commands) cannot be changed here. Use dryRun first. Prefer update-scene, manage-actors, journal-set-page, update-token, update-roll-table, manage-effects and the other specialised tools where they fit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Id of the document, together with documentType | |
| uuid | No | uuid of the document, e.g. "Actor.abc", "Scene.abc.Token.def", "Compendium.dnd5e.monsters.Actor.abc" | |
| dryRun | No | Only check and preview; nothing is written. Recommended before the real call | |
| remove | No | Field paths to delete: a key, or a list entry such as "system.skills.1" | |
| changes | No | Changes by field, e.g. { "system.attributes.hp.value": 7, "name": "Grok" } | |
| replace | No | Keys of changes whose object replaces the stored object instead of merging | |
| parentUuid | No | uuid of the document that holds an embedded one, e.g. "Actor.abc" for its items, "Scene.abc" for its walls | |
| documentType | No | Foundry document name, e.g. "Actor", "JournalEntryPage", "Combat", "Wall"; with id when no uuid is given |