Approval Patterns for MCP Writes: Preview Diffs and Confirmation Tokens
Prevent accidental writes in MCP workflows with robust approval patterns. This deep dive covers multiple approval strategies: explicit yes/no confirmations, confirmation tokens, diff previews, and staged changes—with practical examples for create_task and update_task operations.
What This Guide Covers
This guide teaches you multiple approval patterns for safe write operations:
Approval Patterns
- Explicit yes/no: Simple confirmation before writes
- Confirmation token: Require specific token to proceed
- Diff preview: Show what will change before applying
- Staged changes: Build changes incrementally with review
- Combined patterns: Mix patterns for maximum safety
Pattern 1: Explicit Yes/No Confirmation
The simplest pattern: ask for explicit confirmation before any write:
Create Task with Confirmation
What the AI does:
- Shows preview of task details
- Waits for explicit "YES" or "CONFIRM"
- Only calls
create_taskafter confirmation - If no confirmation, does nothing
Update Task with Confirmation
What the AI does:
- Calls
get_taskto show current state - Shows what will change
- Waits for "APPROVE" confirmation
- Only calls
update_taskafter approval
Pattern 2: Confirmation Token
Require a specific token to prevent accidental confirmations:
Token-Based Confirmation
Benefits:
- Prevents accidental "yes" responses
- Requires intentional confirmation
- Can use different tokens for different operations
Pattern 3: Diff Preview
Show exactly what will change before applying updates:
Update with Diff Preview
What the AI does:
- Calls
get_taskto get current state - Creates diff showing before/after
- Displays diff in readable format
- Waits for approval before calling
update_task
Pattern 4: Staged Changes
Build changes incrementally with review at each stage:
Staged Update Process
Benefits:
- Review each change individually
- Can approve some changes, reject others
- Final batch update after all approvals
Complete Examples
Example 1: Create Task (Full Pattern)
Complete Create Task Prompt
This pattern: Combines preview + confirmation token for maximum safety
Example 2: Update Task (Diff Pattern)
Complete Update Task Prompt
This pattern: Shows diff + requires explicit approval
Best Practices
Safety Recommendations
- Always preview: Show what will change before applying
- Use confirmation tokens: Require specific tokens for important operations
- Show diffs: Make changes visible and clear
- Batch carefully: For multiple changes, show all diffs before applying
- Read before write: Always fetch current state before updating
- Timeout handling: If no confirmation received, don't proceed
Combining Patterns
You can combine multiple patterns for maximum safety:
Combined Pattern Example
This combines: Preview + Diff + Confirmation Token
Troubleshooting
AI Proceeds Without Confirmation
Symptom: AI creates/updates without waiting for approval
Fix:
- Be more explicit: "WAIT for my confirmation"
- Use confirmation tokens instead of yes/no
- Add: "If I don't confirm, do NOT proceed"
Diff Not Clear
Symptom: Can't see what will change
Fix:
- Ask AI to format diff as "Before → After"
- Request side-by-side comparison
- Ask to highlight only changed fields
Related Resources
Write Safety Guide
Preventing accidental writes
Least Privilege Workflows
Safe write workflow patterns
MCP Security
Security best practices
Create Task Tool
Tool reference
Implement Safe Write Approvals
Use approval patterns to prevent accidental writes in MCP workflows
