# Changesets tools

[All tool areas](/docs/tools.md). Each tool acts within your access.

## Changesets

### apply_changeset

Apply a previewed change by its confirmation id (chg_...). Only call this after showing the preview and getting a clear yes. Applying the same id twice is safe and returns the first result.

Prepares a change to approve · Any signed-in person

#### Input

- `changesetId` — string; required. The changeset's confirmation id (chg_...), as the write's preview returned it

#### Output

- `id` — string; required. 
- `tool` — string; required. 
- `status` — string; required.  Allowed: "previewed", "expired", "applied", "undone"
- `summary` — string; required. 
- `changes` — array; required. 
  - `changes[]` — object; optional. 
    - `changes[].action` — string; required.  Allowed: "create", "update", "delete"
    - `changes[].subject` — string; required. 
    - `changes[].description` — string; required. 
- `warnings` — array; required. What to tell the person before they apply it that isn't a change itself, e.g. upcoming sessions a lower capacity leaves oversold
  - `warnings[]` — string; optional. 
- `details` — object or null; optional. More for a screen to show, in the tool's own shape: invite_member's access, as preview_member_access gives it. Null for most tools
  - `details.*` — any value; optional. 
- `result` — any value; required. 
- `createdAt` — string; required.  format: "date-time"
- `expiresAt` — string; required.  format: "date-time"
- `appliedAt` — string or null; required.  format: "date-time"
- `undoUntil` — string or null; required.  format: "date-time"
- `undoneAt` — string or null; required.  format: "date-time"
- `canUndo` — boolean; required. 
- `draftedBy` — object or null; optional. Set when the command bar's assistant drafted exactly this change and the person previewed it (preview_changeset): the assistant and its model call. The person is still the one who makes it. Always sent; null otherwise
  - `draftedBy.agentId` — string; required. 
  - `draftedBy.callId` — string; required. 
- `undoable` — boolean; required. Whether this change can be undone once applied (for 15 minutes): false for tools with no undo (refunds, cancelling an order), and for a change its preview says can't be (cancel_session once it cancels bookings, move_session once it takes any off), whose summary says so too

### get_changeset

Get a changeset by its id: what it changes, whether it's been applied or undone, and its result.

Reads · Any signed-in person

#### Input

- `changesetId` — string; required. The changeset's confirmation id (chg_...), as the write's preview returned it

#### Output

- `id` — string; required. 
- `tool` — string; required. 
- `status` — string; required.  Allowed: "previewed", "expired", "applied", "undone"
- `summary` — string; required. 
- `changes` — array; required. 
  - `changes[]` — object; optional. 
    - `changes[].action` — string; required.  Allowed: "create", "update", "delete"
    - `changes[].subject` — string; required. 
    - `changes[].description` — string; required. 
- `warnings` — array; required. What to tell the person before they apply it that isn't a change itself, e.g. upcoming sessions a lower capacity leaves oversold
  - `warnings[]` — string; optional. 
- `details` — object or null; optional. More for a screen to show, in the tool's own shape: invite_member's access, as preview_member_access gives it. Null for most tools
  - `details.*` — any value; optional. 
- `result` — any value; required. 
- `createdAt` — string; required.  format: "date-time"
- `expiresAt` — string; required.  format: "date-time"
- `appliedAt` — string or null; required.  format: "date-time"
- `undoUntil` — string or null; required.  format: "date-time"
- `undoneAt` — string or null; required.  format: "date-time"
- `canUndo` — boolean; required. 
- `draftedBy` — object or null; optional. Set when the command bar's assistant drafted exactly this change and the person previewed it (preview_changeset): the assistant and its model call. The person is still the one who makes it. Always sent; null otherwise
  - `draftedBy.agentId` — string; required. 
  - `draftedBy.callId` — string; required. 
- `undoable` — boolean; required. Whether this change can be undone once applied (for 15 minutes): false for tools with no undo (refunds, cancelling an order), and for a change its preview says can't be (cancel_session once it cancels bookings, move_session once it takes any off), whose summary says so too

### undo_changeset

Undo an applied change by its id, within its undo window (see undoUntil). Fails if the change can't be undone or has been built on since.

Prepares a change to approve · Any signed-in person

#### Input

- `changesetId` — string; required. The changeset's confirmation id (chg_...), as the write's preview returned it

#### Output

- `id` — string; required. 
- `tool` — string; required. 
- `status` — string; required.  Allowed: "previewed", "expired", "applied", "undone"
- `summary` — string; required. 
- `changes` — array; required. 
  - `changes[]` — object; optional. 
    - `changes[].action` — string; required.  Allowed: "create", "update", "delete"
    - `changes[].subject` — string; required. 
    - `changes[].description` — string; required. 
- `warnings` — array; required. What to tell the person before they apply it that isn't a change itself, e.g. upcoming sessions a lower capacity leaves oversold
  - `warnings[]` — string; optional. 
- `details` — object or null; optional. More for a screen to show, in the tool's own shape: invite_member's access, as preview_member_access gives it. Null for most tools
  - `details.*` — any value; optional. 
- `result` — any value; required. 
- `createdAt` — string; required.  format: "date-time"
- `expiresAt` — string; required.  format: "date-time"
- `appliedAt` — string or null; required.  format: "date-time"
- `undoUntil` — string or null; required.  format: "date-time"
- `undoneAt` — string or null; required.  format: "date-time"
- `canUndo` — boolean; required. 
- `draftedBy` — object or null; optional. Set when the command bar's assistant drafted exactly this change and the person previewed it (preview_changeset): the assistant and its model call. The person is still the one who makes it. Always sent; null otherwise
  - `draftedBy.agentId` — string; required. 
  - `draftedBy.callId` — string; required. 
- `undoable` — boolean; required. Whether this change can be undone once applied (for 15 minutes): false for tools with no undo (refunds, cancelling an order), and for a change its preview says can't be (cancel_session once it cancels bookings, move_session once it takes any off), whose summary says so too
