delete_case
Remove a case in the create stage by providing its caseID. This ensures efficient management of incomplete or unnecessary cases within the Pega DX MCP Server environment.
Instructions
Delete a case that is currently in the create stage
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| caseID | Yes | Full case handle (e.g.,ON6E5R-DIYRECIPE-WORK-RECIPECOLLECTION R-1008) |
Implementation Reference
- src/tools/cases/delete-case.js:36-68 (handler)The execute method implements the 'delete_case' tool handler logic: parameter validation, session handling, API call to pegaClient.deleteCase, error handling, and response formatting.async execute(params) { const { caseID } = params; let sessionInfo = null; try { // Initialize session configuration if provided sessionInfo = this.initializeSessionConfig(params); // Validate required parameters using base class const requiredValidation = this.validateRequiredParams(params, ['caseID']); if (requiredValidation) { return requiredValidation; } // Execute with standardized error handling return await this.executeWithErrorHandling( `Case Deletion: ${caseID}`, async () => await this.pegaClient.deleteCase(caseID.trim()), { caseID, sessionInfo } ); } catch (error) { return { content: [{ type: 'text', text: `## Error: Delete Case **Unexpected Error**: ${error.message} ${sessionInfo ? `**Session**: ${sessionInfo.sessionId} (${sessionInfo.authMode} mode)\n` : ''}*Error occurred at: ${new Date().toISOString()}*` }] }; } }
- src/tools/cases/delete-case.js:15-31 (schema)The getDefinition static method defines the MCP tool schema for 'delete_case', including name, description, and input schema requiring 'caseID'.static getDefinition() { return { name: 'delete_case', description: 'Delete a case that is currently in the create stage', inputSchema: { type: 'object', properties: { caseID: { type: 'string', description: 'Full case handle (e.g.,ON6E5R-DIYRECIPE-WORK-RECIPECOLLECTION R-1008)' }, sessionCredentials: getSessionCredentialsSchema() }, required: ['caseID'] } }; }
- src/tools/cases/delete-case.js:73-96 (helper)Custom formatSuccessResponse helper method for formatting successful delete_case responses with case details and warnings.formatSuccessResponse(operation, data, options = {}) { const { caseID, sessionInfo } = options; let response = `## ${operation}\n\n`; response += `*Operation completed at: ${new Date().toISOString()}*\n\n`; // Session Information (if applicable) if (sessionInfo) { response += `### Session Information\n`; response += `- **Session ID**: ${sessionInfo.sessionId}\n`; response += `- **Authentication Mode**: ${sessionInfo.authMode.toUpperCase()}\n`; response += `- **Configuration Source**: ${sessionInfo.configSource}\n\n`; } response += `✅ **Case ID**: ${caseID}\n\n`; response += '### Operation Details\n'; response += '- The case has been permanently removed from the system\n'; response += '- This action cannot be undone\n'; response += '- Only cases in the create stage can be deleted\n\n'; return response; }
- src/api/pega-client.js:199-200 (helper)The underlying pegaClient.deleteCase method called by the tool handler to perform the actual case deletion via the Pega API client.async deleteCase(caseID) { return this.client.deleteCase(caseID);