Skip to main content
Glama

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
NameRequiredDescriptionDefault
workflowIdYes
reasonNo

Implementation Reference

  • 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'],
      },
    },
  • 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');
    }
  • 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);
  • MCP server registration for listing tools, which includes the 'cancelWorkflow' tool definition from the tools array.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/indrasishbanerjee/aem-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server