Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/TOOLS-REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ Spec Workflow MCP provides specialized tools for structured software development

### delete-approval

**Purpose**: Removes completed approval requests to clean up the approval queue.
**Purpose**: Removes completed, rejected, or needs-revision approval requests to clean up the approval queue. Cannot delete pending approvals.

**Parameters**:

Expand Down
14 changes: 7 additions & 7 deletions docs/technical-documentation/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,9 @@ sequenceDiagram

### `delete-approval`

**Purpose**: Clean up approval after successful approval
**Purpose**: Clean up completed, rejected, or needs-revision approvals. Cannot delete pending approvals.

**Usage**: Call immediately after `approved` status before proceeding
**Usage**: Call to clean up old approval requests after workflow completion

```typescript
// Parameters
Expand All @@ -632,19 +632,19 @@ sequenceDiagram
nextSteps: ["Proceed to next phase"]
}

// Response - Failed
// Response - Failed
{
success: false,
message: "Failed to delete approval: Approval not found or still pending",
message: "Failed to delete approval: Approval not found or is still pending",
nextSteps: [
"Check approval status first",
"Ensure approval is approved before deletion",
"BLOCKING: Cannot proceed until cleanup succeeds"
"Cannot delete pending approvals - wait for approval/rejection/revision",
"Can delete: approved, rejected, or needs-revision status"
]
}
```

**Critical**: If deletion fails, **STOP** and return to polling status. Never proceed without successful cleanup.
**Note**: Pending approvals cannot be deleted. You can delete approvals with status: `approved`, `rejected`, or `needs-revision`.

## 🔄 Common Usage Patterns

Expand Down
16 changes: 9 additions & 7 deletions src/tools/approvals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const approvalsTool: Tool = {
Use this tool to request, check status, or delete approval requests. The action parameter determines the operation:
- 'request': Create a new approval request after creating each document
- 'status': Check the current status of an approval request
- 'delete': Clean up completed approval requests
- 'delete': Clean up completed, rejected, or needs-revision approval requests (cannot delete pending requests)

CRITICAL: Only provide filePath parameter for requests - the dashboard reads files directly. Never include document content. Wait for user to review and approve before continuing.`,
inputSchema: {
Expand Down Expand Up @@ -376,11 +376,12 @@ async function handleDeleteApproval(
};
}

// Only allow deletion of approved requests
if (approval.status !== 'approved') {
// Only block deletion of pending requests (still awaiting approval)
// Allow deletion of: approved, needs-revision, rejected
if (approval.status === 'pending') {
return {
success: false,
message: `BLOCKED: Cannot proceed - status is "${approval.status}". VERBAL APPROVAL NOT ACCEPTED. Use dashboard or VS Code extension.`,
message: `BLOCKED: Cannot delete - status is "${approval.status}". This approval is still awaiting review. VERBAL APPROVAL NOT ACCEPTED. Use dashboard or VS Code extension.`,
data: {
approvalId: args.approvalId,
currentStatus: approval.status,
Expand All @@ -389,9 +390,10 @@ async function handleDeleteApproval(
canProceed: false
},
nextSteps: [
'STOP - Do not proceed to next phase',
'Wait for approval',
'Poll with approvals action:"status"'
'STOP - Cannot delete pending approval',
'Wait for approval or rejection',
'Poll with approvals action:"status"',
'Delete only after status changes to approved, rejected, or needs-revision'
]
};
}
Expand Down