Snapshot an instance subtree and diff what an action changed
diff-instance-snapshotCapture a baseline of a Roblox instance subtree, run an in-game action, then diff before and after to see which instances were added, removed, or changed.
Instructions
Answer 'what did clicking this button / firing this remote / opening this menu actually change in the game tree?' by snapshotting an instance subtree, performing the action in-game, then diffing the before/after. Workflow: (1) call action='snapshot' on a root (default game.Workspace) to capture a baseline; (2) do the thing in-game (click, fire a remote, walk somewhere, wait for a wave to spawn); (3) call action='compare' with the SAME name to see exactly which instances were ADDED, REMOVED, or CHANGED. How it works: it walks root:GetDescendants() (capped at maxInstances) and builds a per-instance signature from a handful of cheap properties (ClassName, Name, Parent, and whichever of Position/Transparency/Value/Text/Visible/Anchored/Health/Enabled exist). 'changed' entries report the before and after signatures so you can see precisely which property moved (a part teleported, a value bumped, a label retexted, a GUI shown). State is stored CLIENT-SIDE in getgenv().__mcp_snapshots[name], so baselines persist across tool calls and are naturally isolated per game / per session. Use distinct names to keep several independent baselines. snapshot returns: { action='snapshot', name, root, captured, truncated }. compare returns: { action='compare', name, root, counts={ added, removed, changed }, added=[paths], removed=[paths], changed=[{ path, before, after }], truncated=bool }. Non-mutating and fully pcall-guarded (locked/destroyed instances are skipped, never aborting the scan). Each detail list is capped at 200 entries; the exact counts are always reported. Signature: { action: "snapshot" | "compare", root: any?, name: any?, maxInstances: any?, threadContext: number? }. Phase: verify; cost=medium; idempotency=read-only. Requires: active-client. Produces: structured-result. Safety: read-only. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Slot/name for the snapshot (default 'default'). compare diffs against the baseline stored under this same name. Use distinct names to keep several independent before/after pairs around at once. | default |
| root | No | Luau expression for the root instance of the subtree to snapshot/diff (default 'game.Workspace'). Examples: 'game.Workspace', 'game.Players.LocalPlayer.PlayerGui', 'game.Workspace:FindFirstChild("Map")'. Evaluated as `return <root>`. Pick the smallest subtree that contains what you expect to change — a tighter root means a faster, less noisy diff. | game.Workspace |
| action | Yes | 'snapshot' captures a baseline signature map of the subtree under `name`. 'compare' re-walks the subtree now and diffs it against the stored baseline of that `name`, reporting added/removed/changed instances. | |
| maxInstances | No | Max descendants to walk per pass (default 4000). The walk stops at this many and flags `truncated`; a truncated baseline plus a truncated compare can produce spurious added/removed near the cap, so prefer a tighter root over a huge cap. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |