Skip to main content
Glama
Raistlin82

SAP OData to MCP Server

by Raistlin82

UI Workflow Builder

ui-workflow-builder

Design visual workflow processes with step-by-step forms and approvals for SAP entity types, enabling structured business process automation.

Instructions

Creates visual workflow processes with step-by-step forms and approvals

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflowNameYesName of the workflow process
stepsYesWorkflow step definitions
entityTypeYesSAP entity type for the workflow

Implementation Reference

  • Comprehensive Zod input schema defining all parameters for creating UI workflows including steps, transitions, roles, notifications, escalation, and integrations.
    const UIWorkflowBuilderSchema = {
        workflowType: z.string().describe("Type of workflow (e.g., 'approval', 'onboarding', 'order-processing')"),
        title: z.string().describe("Workflow title"),
        description: z.string().optional().describe("Workflow description"),
        steps: z.array(z.object({
            id: z.string().describe("Unique step identifier"),
            name: z.string().describe("Step display name"),
            description: z.string().optional().describe("Step description"),
            component: z.enum(['form', 'approval', 'notification', 'decision', 'data-entry', 'review', 'custom']).describe("Step component type"),
            config: z.object({
                entityType: z.string().optional().describe("SAP entity type for data operations"),
                formFields: z.array(z.object({
                    name: z.string(),
                    label: z.string(),
                    type: z.string(),
                    required: z.boolean().optional(),
                    validation: z.record(z.any()).optional()
                })).optional().describe("Form fields for form components"),
                approvers: z.array(z.object({
                    role: z.string(),
                    required: z.boolean().optional(),
                    escalationTime: z.number().optional()
                })).optional().describe("Approvers for approval components"),
                conditions: z.array(z.object({
                    field: z.string(),
                    operator: z.enum(['equals', 'not_equals', 'greater_than', 'less_than', 'contains']),
                    value: z.any()
                })).optional().describe("Conditions for decision components"),
                template: z.string().optional().describe("Custom template for notifications"),
                dataSource: z.object({
                    entitySet: z.string().optional(),
                    query: z.record(z.any()).optional()
                }).optional().describe("Data source configuration")
            }).optional().describe("Step-specific configuration"),
            validators: z.array(z.object({
                type: z.enum(['required', 'format', 'business', 'approval']),
                config: z.record(z.any()).optional()
            })).optional().describe("Step validation rules"),
            actions: z.array(z.object({
                type: z.enum(['validate', 'save', 'execute', 'navigate', 'notify', 'approve', 'reject']),
                target: z.string().optional(),
                condition: z.string().optional(),
                config: z.record(z.any()).optional()
            })).optional().describe("Step actions"),
            timeout: z.number().optional().describe("Step timeout in seconds"),
            parallel: z.boolean().optional().describe("Allow parallel execution")
        })).describe("Workflow steps"),
        transitions: z.record(z.record(z.string())).optional().describe("Step transition rules"),
        roles: z.array(z.object({
            id: z.string(),
            name: z.string(),
            permissions: z.array(z.string()),
            steps: z.array(z.string()).optional().describe("Steps this role can access")
        })).optional().describe("Workflow roles and permissions"),
        persistence: z.enum(['localStorage', 'sessionStorage', 'server', 'sap']).optional().describe("Data persistence method"),
        notifications: z.object({
            email: z.boolean().optional(),
            sms: z.boolean().optional(),
            push: z.boolean().optional(),
            sapInbox: z.boolean().optional()
        }).optional().describe("Notification settings"),
        escalation: z.object({
            enabled: z.boolean(),
            timeouts: z.record(z.number()).optional(),
            escalationChain: z.array(z.string()).optional()
        }).optional().describe("Escalation configuration"),
        analytics: z.object({
            trackStepTime: z.boolean().optional(),
            trackUserActions: z.boolean().optional(),
            generateReports: z.boolean().optional()
        }).optional().describe("Analytics configuration"),
        integration: z.object({
            sapWorkflowService: z.boolean().optional(),
            externalApi: z.string().optional(),
            webhooks: z.array(z.object({
                event: z.string(),
                url: z.string()
            })).optional()
        }).optional().describe("External system integration")
    };
  • Tool registration method that registers 'ui-workflow-builder' with MCP server, including title, detailed description, input schema, and handler function.
        public async register(): Promise<void> {
            this.mcpServer.registerTool(
                "ui-workflow-builder",
                {
                    title: "UI Workflow Builder",
                    description: `Create visual workflow processes with step-by-step forms and approvals.
    
    Features:
    - Visual workflow designer with drag-and-drop interface
    - Multiple step types (forms, approvals, decisions, notifications)
    - Role-based access control and permissions
    - Conditional branching and parallel execution
    - Integration with SAP Workflow Service
    - Email, SMS, and push notifications
    - Escalation and timeout handling
    - Real-time progress tracking
    - Analytics and reporting
    - Mobile-responsive design
    - Audit trail and compliance
    
    Required scope: ui.workflows
    
    Step Types:
    - form: Data entry forms with validation
    - approval: Multi-level approval processes
    - notification: Email/SMS notifications
    - decision: Conditional branching based on data
    - data-entry: Direct SAP data manipulation
    - review: Data review and verification
    - custom: Custom HTML/JavaScript components
    
    Workflow Types:
    - approval: Document/request approval flows
    - onboarding: Employee/customer onboarding
    - order-processing: Order fulfillment workflows
    - incident-management: Issue resolution processes
    - change-request: Change management workflows
    
    Examples:
    - Purchase approval: {"workflowType": "approval", "steps": [...]}
    - Employee onboarding: {"workflowType": "onboarding", "title": "New Employee Setup"}
    - Order processing: {"workflowType": "order-processing", "integration": {...}}`,
                    inputSchema: UIWorkflowBuilderSchema
                },
                async (args: Record<string, unknown>) => {
                    return await this.handleWorkflowBuilding(args);
                }
            );
    
            this.logger.info("✅ UI Workflow Builder tool registered successfully");
        }
  • Primary handler function that executes the tool: validates input, checks authorization, validates workflow structure, enhances steps, generates UI components, integrates SAP features, and returns formatted response with HTML/CSS/JS.
    private async handleWorkflowBuilding(args: unknown): Promise<any> {
        try {
            // Validate input parameters
            const params = z.object(UIWorkflowBuilderSchema).parse(args);
    
            this.logger.info(`🔄 Building workflow: ${params.title} (${params.workflowType}) with ${params.steps.length} steps`);
    
            // Check authentication and authorization
            const authCheck = await this.checkUIAccess('ui.workflows');
            if (!authCheck.hasAccess) {
                return {
                    content: [{
                        type: "text",
                        text: `❌ Authorization denied: ${authCheck.reason || 'Access denied for UI workflow building'}\n\nRequired scope: ui.workflows`
                    }]
                };
            }
    
            // Step 1: Validate workflow structure
            const validationResult = await this.validateWorkflowStructure(params);
            if (!validationResult.valid) {
                return {
                    content: [{
                        type: "text",
                        text: `❌ Workflow validation failed:\n${validationResult.errors.join('\n')}`
                    }]
                };
            }
    
            // Step 2: Prepare workflow steps with enhanced configurations
            const enhancedSteps = await this.enhanceWorkflowSteps(params.steps);
    
            // Step 3: Create transition rules
            const transitionRules = this.createTransitionRules(enhancedSteps, params.transitions);
    
            // Step 4: Create workflow configuration
            const workflowConfig: WorkflowConfig = {
                workflowType: params.workflowType,
                steps: enhancedSteps,
                transitions: transitionRules,
                persistence: params.persistence || 'localStorage'
            };
    
            // Step 5: Generate workflow UI
            const workflowResult = await this.componentLibrary.generateWorkflowBuilder(workflowConfig);
    
            // Step 6: Add SAP-specific enhancements
            const enhancedResult = await this.enhanceWorkflowResult(workflowResult, params);
    
            // Step 7: Prepare response
            const response = this.createWorkflowResponse(enhancedResult, params, enhancedSteps);
    
            this.logger.info(`✅ Workflow '${params.title}' built successfully`);
    
            return {
                content: [
                    {
                        type: "text",
                        text: `# ${params.title}\n\n` +
                              `${params.description || `Visual ${params.workflowType} workflow with step-by-step process`}\n\n` +
                              `## Workflow Overview:\n` +
                              `- Type: ${params.workflowType}\n` +
                              `- Steps: ${params.steps.length}\n` +
                              `- Roles: ${params.roles?.length || 0}\n` +
                              `- Persistence: ${params.persistence || 'localStorage'}\n` +
                              `- Notifications: ${this.getNotificationSummary(params.notifications)}\n` +
                              `- Escalation: ${params.escalation?.enabled ? '✅' : '❌'}\n\n` +
                              `## Workflow Steps:\n` +
                              params.steps.map((step, index) =>
                                  `${index + 1}. **${step.name}** (${step.component})\n   ${step.description || 'No description'}`
                              ).join('\n') + '\n\n' +
                              `## Features:\n` +
                              `- Visual Progress Indicator: ✅\n` +
                              `- Role-based Access Control: ${params.roles?.length ? '✅' : '❌'}\n` +
                              `- Conditional Branching: ${enhancedSteps.some(s => s.transitions) ? '✅' : '❌'}\n` +
                              `- Integration: ${params.integration ? Object.keys(params.integration).join(', ') : 'None'}\n` +
                              `- Analytics: ${params.analytics?.trackStepTime ? '✅' : '❌'}\n\n` +
                              `Start the workflow by clicking the 'Begin Process' button in the generated interface.`
                    },
                    {
                        type: "resource",
                        data: response,
                        mimeType: "application/json"
                    }
                ]
            };
    
        } catch (error) {
            this.logger.error(`❌ Failed to build workflow`, error as Error);
            return {
                content: [{
                    type: "text",
                    text: `❌ Failed to build workflow: ${(error as Error).message}`
                }]
            };
        }
    }
  • Scope mapping registration for UI tools in authentication validator, mapping 'ui-workflow-builder' to required 'ui.workflows' scope.
    const scopeMapping: Record<string, string> = {
      'ui-form-generator': 'ui.forms',
      'ui-data-grid': 'ui.grids',
      'ui-dashboard-composer': 'ui.dashboards',
      'ui-workflow-builder': 'ui.workflows',
      'ui-report-builder': 'ui.reports',
    };
  • Scope mapping for authorization in MCP auth manager, defining 'ui-workflow-builder' requires 'ui.workflows' scope.
      'ui-form-generator': 'ui.forms',
      'ui-data-grid': 'ui.grids',
      'ui-dashboard-composer': 'ui.dashboards',
      'ui-workflow-builder': 'ui.workflows',
      'ui-report-builder': 'ui.reports',
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool 'creates' workflows, implying a write/mutation operation, but doesn't cover permissions, side effects, error handling, or what happens after creation (e.g., where workflows are stored, if they're immediately active). For a creation tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. Every word earns its place: 'Creates' (action), 'visual workflow processes' (resource), 'with step-by-step forms and approvals' (key features). There's no redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool that creates workflows with three required parameters and no annotations or output schema, the description is incomplete. It doesn't address behavioral aspects like permissions, side effects, or what the tool returns. The agent lacks context on how to interpret success/failure or use the created workflows. Given the complexity implied by 'visual workflow processes,' more guidance is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters. The description adds no parameter-specific information beyond what's in the schema. It mentions 'step-by-step forms and approvals,' which loosely relates to the 'steps' parameter with its 'type' enum including 'form' and 'approval,' but doesn't provide additional semantic context. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Creates visual workflow processes with step-by-step forms and approvals.' It specifies the verb ('creates'), resource ('visual workflow processes'), and key components ('forms and approvals'). However, it doesn't explicitly differentiate from sibling tools like 'ui-dashboard-composer' or 'ui-form-generator' that might also create UI elements.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, appropriate contexts, or exclusions. Given the sibling tools include various UI builders and data tools, the agent must infer usage based on the name and description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/Raistlin82/btp-sap-odata-to-mcp-server-optimized'

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