cancelWorkflow
Stop a running workflow instance in Adobe Experience Manager by providing the workflow ID and optional reason for cancellation.
Instructions
Cancel a workflow instance
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflowId | Yes | ||
| reason | No |
Implementation Reference
- src/mcp-server.ts:475-486 (schema)MCP tool schema definition for 'cancelWorkflow' including input validation schema with required 'workflowId' and optional 'reason'.{ name: 'cancelWorkflow', description: 'Cancel a workflow instance', inputSchema: { type: 'object', properties: { workflowId: { type: 'string' }, reason: { type: 'string' } }, required: ['workflowId'], }, },
- src/mcp-server.ts:773-777 (handler)Primary MCP server handler for the 'cancelWorkflow' tool call. Extracts parameters from args and delegates execution to AEMConnector.cancelWorkflow, formats response as MCP content.case 'cancelWorkflow': { const { workflowId, reason } = args as { workflowId: string; reason?: string }; const result = await aemConnector.cancelWorkflow(workflowId, reason); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- Core implementation of workflow cancellation in WorkflowOperations class. Performs HTTP POST to AEM's `/etc/workflow/instances/{workflowId}` endpoint with abort action and reason, handles errors and formats success response.* Cancel a workflow instance */ async cancelWorkflow(workflowId, reason) { return safeExecute(async () => { if (!workflowId) { throw createAEMError(AEM_ERROR_CODES.INVALID_PARAMETERS, 'Workflow ID is required', { workflowId }); } // Cancel the workflow const cancelData = { action: 'abort', reason: reason || 'Cancelled via AEM MCP Server' }; const response = await this.httpClient.post(`/etc/workflow/instances/${workflowId}`, cancelData, { headers: { 'Content-Type': 'application/json' } }); return createSuccessResponse({ workflowId, reason: cancelData.reason, status: 'ABORTED', cancelledAt: new Date().toISOString() }, 'cancelWorkflow'); }, 'cancelWorkflow'); }
- src/aem-connector-new.ts:252-253 (helper)Delegation method in AEMConnector class that forwards cancelWorkflow call to the specialized WorkflowOperations instance.async cancelWorkflow(workflowId: string, reason?: string) { return this.workflowOps.cancelWorkflow(workflowId, reason);
- src/mcp-server.ts:578-580 (registration)MCP server registration for listing tools, which includes the 'cancelWorkflow' tool definition from the tools array.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });