Tool Permission System
X21 puts humans in control of every workbook change. When Claude proposes using a tool, the orchestrator pauses execution until a decision is made. This section explains how the permission flow works and how to use it effectively.Lifecycle of a Tool Request
- Claude emits a
tool_useblock (e.g.,write_values) while generating a response. - The Deno backend registers the request in
stateManager.addInitialToolChange, marks it as pending, and sendstool:permissionto the UI. - The UI creates a card in the Pending Actions panel and decides whether to auto-approve based on:
- Manual toggles (
autoApproveEnabled,approveAllEnabled). toolsNotRequiringApproval(safe read-only tools such asread_values).
- Manual toggles (
- The user can:
- View – Executes the tool via
tool:view, applies changes temporarily, and captures revert data. - Approve – Runs
toolExecutionFlow, persists results, marks the tool as approved, and continues the Claude stream. - Reject – Cancels execution, records the user message, and updates conversation history so Claude adapts.
- Revert / Apply – After approval, use these options to undo or redo part of the change set (
revertToolChangesForWorkbookFromToolIdOnwards/applyFromToolIdOnwards).
- View – Executes the tool via
Understanding Tool State
Each tool tracks several flags stored inToolChangeInterface:
pending– Awaiting decision.applied– Tool executed against Excel (either via View or Approve).approved– User confirmed the change.inputDataRevert– Snapshot of the workbook state used to revert if needed.
Batch Approvals
- When multiple tools require approval, the UI can send a single
tool:permission:responsewithtoolResponsesfor each item. - The backend processes approvals sequentially, logging successes and failures. Any tool that throws
ToolExecutionErroris marked as failed, and Claude is informed so it can retry or apologise. - Mixed decisions are allowed: some tools can be approved while others are rejected, and the LLM continues with updated context.
Best Practices
- Preview before approving for destructive actions like
remove_rowsorwrite_format. - Reject with context – Provide a short message explaining why the tool was denied so Claude can adjust its strategy.
- Leverage auto-approve for read operations during exploratory analysis to reduce latency.
- Monitor batch operations – When approving many tools at once, watch the conversation for any follow-up suggestions in case a subset failed.

