diff --git a/docs/TOOLS-REFERENCE.md b/docs/TOOLS-REFERENCE.md index d1818b1..0822cee 100644 --- a/docs/TOOLS-REFERENCE.md +++ b/docs/TOOLS-REFERENCE.md @@ -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**: diff --git a/docs/technical-documentation/api-reference.md b/docs/technical-documentation/api-reference.md index 2d3b94b..06cc8e9 100644 --- a/docs/technical-documentation/api-reference.md +++ b/docs/technical-documentation/api-reference.md @@ -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 @@ -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 diff --git a/src/tools/approvals.ts b/src/tools/approvals.ts index 2439b99..4d46736 100644 --- a/src/tools/approvals.ts +++ b/src/tools/approvals.ts @@ -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: { @@ -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, @@ -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' ] }; }