Capture, rollback, and clean up bounded live state transactions
state-transactionBegin bounded client-state transactions, capture requested Instance properties, attributes, and camera fields, then rollback or commit changes with per-item cleanup.
Instructions
STATE TRANSACTION JOURNAL. Begin a bounded getgenv-backed transaction, capture explicitly requested Instance properties/attributes and camera fields, register known cleanup resources, inspect status, commit without restoration, or rollback in reverse journal order with pcall-isolated per-item results. Cleanup can rollback or explicitly discard expired and cross-place/job orphaned transactions. Registered resources support MCP Drawing ids, held virtual input releases, connection state restoration or cleanup-only disconnection, and canonical __mcp_hooks/__mcp_hook_meta entries when their metadata is safely understood. This is a best-effort client-state journal, not a general undo system: destroyed Instances, fired remotes, server-side changes, arbitrary script side effects, and connections destroyed before capture cannot be reconstructed. Commit intentionally discards all snapshots and does not clean registered resources. Signature: { action: "begin" | "capture" | "status" | "commit" | "rollback" | "cleanup", transactionId: string?, name: string?, targets: any?, captureCamera: any?, cleanupItems: any?, maxItems: number?, expirySeconds: number?, limit: any?, cleanupMode: any?, includeOrphans: any?, threadContext: number? }. Phase: act; cost=medium; idempotency=contextual-write. Requires: active-client, explicit-mutation-approval, begin a transaction before mutating reversible client state, capture every property/attribute before changing it. Capabilities: getgenv. Produces: grounded-evidence, bounded state journal, per-item rollback evidence, expired/orphaned cleanup report. Verify with: assert-state. Safety: MUTATING; writes live game/client state, capture stores raw client references in getgenv until commit, rollback, cleanup, expiry, or executor shutdown, rollback writes captured values and runs registered cleanup actions in reverse order, connection disconnect cleanup is irreversible and is reported separately from reversible restoration. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Human label; later actions may use it only when exactly one active transaction matches. | |
| limit | No | Maximum transactions listed or processed by status/cleanup. | |
| action | Yes | Transaction lifecycle action. | |
| targets | No | Explicit property/attribute snapshot targets for begin or capture. | |
| maxItems | No | Per-transaction journal cap (default 128, hard maximum 256); for capture it may only lower the call cap. | |
| cleanupMode | No | For cleanup, rollback attempts every journal item first; discard explicitly removes journals without restoration. | rollback |
| cleanupItems | No | Resources to release/restore during reverse-order rollback. | |
| captureCamera | No | Snapshot CurrentCamera CameraType, CameraSubject, CFrame, Focus, and FieldOfView. | |
| expirySeconds | No | Seconds until cleanup considers the transaction expired (default 900 on begin). Capture may refresh it. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. | |
| transactionId | No | Stable transaction id. Optional for begin (one is generated); required by id for unambiguous later actions. | |
| includeOrphans | No | For cleanup, include transactions created in another PlaceId/JobId, not only expired ones. |