Skip to main content
Glama

startWorkflow

Initiate a new workflow instance in Adobe Experience Manager by specifying the workflow model and payload path to automate content processes.

Instructions

Start a new workflow instance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYes
payloadPathYes
titleNo
commentNo

Implementation Reference

  • Core handler function that executes the startWorkflow tool logic: validates inputs, checks payload existence, starts workflow via AEM API, extracts ID, and returns formatted response.
    async startWorkflow(request) {
        return safeExecute(async () => {
            const { model, payloadPath, title, comment } = request;
            if (!model || !payloadPath) {
                throw createAEMError(AEM_ERROR_CODES.INVALID_PARAMETERS, 'Model and payload path are required', { model, payloadPath });
            }
            // Validate payload path exists
            try {
                await this.httpClient.get(`${payloadPath}.json`);
            }
            catch (error) {
                if (error.response?.status === 404) {
                    throw createAEMError(AEM_ERROR_CODES.INVALID_PARAMETERS, `Payload path not found: ${payloadPath}`, { payloadPath });
                }
                throw handleAEMHttpError(error, 'startWorkflow');
            }
            // Start workflow using AEM's workflow API
            const workflowData = {
                model: model,
                payload: payloadPath,
                title: title || `Workflow for ${payloadPath}`,
                comment: comment || 'Started via AEM MCP Server'
            };
            const response = await this.httpClient.post('/etc/workflow/instances', workflowData, {
                headers: {
                    'Content-Type': 'application/json'
                }
            });
            // Extract workflow ID from response
            const workflowId = this.extractWorkflowId(response.data);
            if (!workflowId) {
                throw createAEMError(AEM_ERROR_CODES.SYSTEM_ERROR, 'Failed to extract workflow ID from response', { response: response.data });
            }
            return createSuccessResponse({
                workflowId,
                model,
                payloadPath,
                title: workflowData.title,
                comment: workflowData.comment,
                status: 'RUNNING',
                createdBy: 'admin', // In real implementation, get from auth context
                createdAt: new Date().toISOString()
            }, 'startWorkflow');
        }, 'startWorkflow');
    }
  • MCP protocol CallTool request handler that dispatches startWorkflow calls to the AEMConnector and formats the response.
    case 'startWorkflow': {
        const result = await aemConnector.startWorkflow(args);
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • Tool registration in MCP server including name, description, and input schema definition.
        name: 'startWorkflow',
        description: 'Start a new workflow instance',
        inputSchema: {
            type: 'object',
            properties: {
                model: { type: 'string' },
                payloadPath: { type: 'string' },
                title: { type: 'string' },
                comment: { type: 'string' }
            },
            required: ['model', 'payloadPath'],
        },
    },
  • Alternative/internal handler dispatch for startWorkflow in MCPRequestHandler class.
    case 'startWorkflow':
        return await this.aemConnector.startWorkflow(params);
  • Delegation handler in AEMConnector that forwards startWorkflow to WorkflowOperations module.
    async startWorkflow(request) {
        return this.workflowOps.startWorkflow(request);
    }

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