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
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | ||
| payloadPath | Yes | ||
| title | No | ||
| comment | No |
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'); }
- dist/mcp-server.js:747-750 (handler)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) }] }; }
- dist/mcp-server.js:429-441 (registration)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'], }, },
- dist/mcp-handler.js:81-82 (handler)Alternative/internal handler dispatch for startWorkflow in MCPRequestHandler class.case 'startWorkflow': return await this.aemConnector.startWorkflow(params);
- dist/aem-connector-new.js:192-194 (handler)Delegation handler in AEMConnector that forwards startWorkflow to WorkflowOperations module.async startWorkflow(request) { return this.workflowOps.startWorkflow(request); }