getStatus
Retrieve the status of a specific workflow by ID using the REST API on the AEM MCP Server. Simplify monitoring and management of workflows within Adobe Experience Manager.
Instructions
Get workflow status by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflowId | Yes |
Implementation Reference
- src/mcp-server.ts:241-248 (registration)Registration of the 'getStatus' tool in the MCP tools list, including name, description, and input schema requiring workflowIdname: 'getStatus', description: 'Get workflow status by ID', inputSchema: { type: 'object', properties: { workflowId: { type: 'string' } }, required: ['workflowId'], }, },
- src/mcp-server.ts:693-696 (handler)MCP server handler for 'getStatus' tool call: extracts workflowId from args and delegates to AEMConnector.getWorkflowStatus, returns JSON responsecase 'getStatus': { const result = await aemConnector.getWorkflowStatus(args.workflowId); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- Core implementation of getWorkflowStatus: fetches workflow instance from AEM via HTTP GET to /etc/workflow/instances/{workflowId}.json, parses status, steps, progress using helpers, handles errors including 404 not foundasync getWorkflowStatus(workflowId: string): Promise<WorkflowStatusResponse> { return safeExecute<WorkflowStatusResponse>(async () => { if (!workflowId) { throw createAEMError( AEM_ERROR_CODES.INVALID_PARAMETERS, 'Workflow ID is required', { workflowId } ); } try { // Get workflow instance details const response = await this.httpClient.get(`/etc/workflow/instances/${workflowId}.json`); const workflowData = response.data; // Parse workflow status and steps const status = this.mapWorkflowStatus(workflowData.state); const steps = this.parseWorkflowSteps(workflowData.history || []); const currentStep = this.getCurrentStep(steps); const progress = this.calculateProgress(steps); return createSuccessResponse({ workflowId, status, currentStep, progress, startedBy: workflowData.startedBy || 'admin', startedAt: workflowData.startedAt || new Date().toISOString(), completedAt: status === 'COMPLETED' ? workflowData.completedAt : undefined, steps }, 'getWorkflowStatus') as WorkflowStatusResponse; } catch (error: any) { if (error.response?.status === 404) { throw createAEMError( AEM_ERROR_CODES.INVALID_PARAMETERS, `Workflow not found: ${workflowId}`, { workflowId } ); } throw handleAEMHttpError(error, 'getWorkflowStatus'); } }, 'getWorkflowStatus'); }
- src/mcp-server.ts:243-248 (schema)Input schema definition for getStatus tool: object with required string workflowIdinputSchema: { type: 'object', properties: { workflowId: { type: 'string' } }, required: ['workflowId'], }, },
- Helper function calculateProgress used in getWorkflowStatus to compute workflow progress percentage from steps statusprivate calculateProgress(steps: any[]): number { if (steps.length === 0) return 0; const completedSteps = steps.filter(step => step.status === 'COMPLETED').length; return Math.round((completedSteps / steps.length) * 100); }