Skip to main content
Glama

design_workflow

Design a multi-step workflow from a natural language description. Returns a draft with proposed steps for review and editing.

Instructions

[WRITE] Start designing a workflow from a natural language description.

Call this when the user describes a complex operation and you need to design a multi-step workflow. Returns a DRAFT workflow with proposed steps for the user to review and edit before execution.

Design flow:

  1. AI calls design_workflow(goal="...") → returns draft with proposed steps

  2. User reviews: "step 3 should use vm_power_off instead" or "add an approval before step 4"

  3. AI calls update_draft(workflow_id, ...) to modify

  4. User confirms: "looks good"

  5. AI calls confirm_draft(workflow_id) → state changes to PENDING

  6. AI calls run_workflow(workflow_id) → execute

The AI should use get_skill_catalog() first to understand available tools, then propose steps based on the user's goal.

Args: goal: Natural language description of what the user wants to accomplish. constraints: Optional constraints (e.g. "must have approval before any destructive step", "use NSX for networking", "target is vcenter-prod").

Returns: dict with workflow_id (state=DRAFT), proposed steps placeholder, and instructions for the AI to fill in steps via update_draft.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
goalYes
constraintsNo

Implementation Reference

  • The 'design_workflow' tool handler function. Registered as an MCP tool and annotated with vmware_tool(risk_level='low'). Takes a 'goal' (str) and optional 'constraints' (str), creates a Workflow with state=DRAFT and empty steps, saves it, and returns a dict with workflow_id, state, goal, constraints, available_skills, and next_step instructions telling the AI to call update_draft() to fill in steps.
    @mcp.tool(annotations={"readOnlyHint": False, "destructiveHint": False, "idempotentHint": False, "openWorldHint": True})
    @vmware_tool(risk_level="low")
    def design_workflow(
        goal: str,
        constraints: str = "",
    ) -> dict:
        """[WRITE] Start designing a workflow from a natural language description.
    
        Call this when the user describes a complex operation and you need to
        design a multi-step workflow. Returns a DRAFT workflow with proposed steps
        for the user to review and edit before execution.
    
        Design flow:
          1. AI calls design_workflow(goal="...") → returns draft with proposed steps
          2. User reviews: "step 3 should use vm_power_off instead" or "add an approval before step 4"
          3. AI calls update_draft(workflow_id, ...) to modify
          4. User confirms: "looks good"
          5. AI calls confirm_draft(workflow_id) → state changes to PENDING
          6. AI calls run_workflow(workflow_id) → execute
    
        The AI should use get_skill_catalog() first to understand available tools,
        then propose steps based on the user's goal.
    
        Args:
            goal: Natural language description of what the user wants to accomplish.
            constraints: Optional constraints (e.g. "must have approval before any destructive step",
                         "use NSX for networking", "target is vcenter-prod").
    
        Returns:
            dict with workflow_id (state=DRAFT), proposed steps placeholder,
            and instructions for the AI to fill in steps via update_draft.
        """
        from datetime import datetime, timezone
        from vmware_pilot.models import Workflow, WorkflowState, new_workflow_id
    
        now = datetime.now(tz=timezone.utc).isoformat()
        wf = Workflow(
            id=new_workflow_id(),
            workflow_type="custom_draft",
            state=WorkflowState.DRAFT,
            steps=[],
            params={"goal": goal, "constraints": constraints, "custom": True},
            created_at=now,
            updated_at=now,
        )
        wf.log("draft_created", f"Goal: {goal}")
        _get_store().save(wf)
    
        return {
            "workflow_id": wf.id,
            "state": "draft",
            "goal": goal,
            "constraints": constraints,
            "available_skills": list(SKILL_CATALOG.keys()),
            "next_step": (
                "Now design the workflow steps. Use get_skill_catalog() to see available tools, "
                "then call update_draft() to add steps. When done, call confirm_draft() to finalize."
            ),
        }
  • Docstring defining the schema for design_workflow: 'goal' (str) is the natural language description of what the user wants, 'constraints' (str, optional) are constraints like approvals or target environment. Returns a dict with workflow_id, state=DRAFT, proposed steps placeholder, and instructions.
    Args:
        goal: Natural language description of what the user wants to accomplish.
        constraints: Optional constraints (e.g. "must have approval before any destructive step",
                     "use NSX for networking", "target is vcenter-prod").
    
    Returns:
        dict with workflow_id (state=DRAFT), proposed steps placeholder,
        and instructions for the AI to fill in steps via update_draft.
    """
    from datetime import datetime, timezone
    from vmware_pilot.models import Workflow, WorkflowState, new_workflow_id
    
    now = datetime.now(tz=timezone.utc).isoformat()
  • Registration of design_workflow as an MCP tool via @mcp.tool(annotations={...}) and @vmware_tool(risk_level='low') decorators. The @mcp.tool decorator registers it with the FastMCP server, making it available to AI agents.
    @mcp.tool(annotations={"readOnlyHint": False, "destructiveHint": False, "idempotentHint": False, "openWorldHint": True})
    @vmware_tool(risk_level="low")
  • Internal helper logic: imports datetime, Workflow, WorkflowState, new_workflow_id from vmware_pilot.models; creates a new Workflow with id, type='custom_draft', state=DRAFT, empty steps, params containing goal/constraints; logs 'draft_created' event; saves via _get_store().save().
    from datetime import datetime, timezone
    from vmware_pilot.models import Workflow, WorkflowState, new_workflow_id
    
    now = datetime.now(tz=timezone.utc).isoformat()
    wf = Workflow(
        id=new_workflow_id(),
        workflow_type="custom_draft",
        state=WorkflowState.DRAFT,
        steps=[],
        params={"goal": goal, "constraints": constraints, "custom": True},
        created_at=now,
        updated_at=now,
    )
    wf.log("draft_created", f"Goal: {goal}")
    _get_store().save(wf)
    
    return {
        "workflow_id": wf.id,
        "state": "draft",
        "goal": goal,
        "constraints": constraints,
        "available_skills": list(SKILL_CATALOG.keys()),
        "next_step": (
            "Now design the workflow steps. Use get_skill_catalog() to see available tools, "
            "then call update_draft() to add steps. When done, call confirm_draft() to finalize."
        ),
    }
  • The update_draft tool (lines 576-639) and confirm_draft tool (lines 644-691) are companion helpers that complete the design workflow flow: update_draft fills in/modifies steps, confirm_draft transitions from DRAFT to PENDING so the workflow can be run.
    def update_draft(
        workflow_id: str,
        name: str = "",
        description: str = "",
        steps: list[dict[str, Any]] | None = None,
    ) -> dict:
        """[WRITE] Update a DRAFT workflow's name, description, or steps.
    
        Call this after design_workflow() to fill in the actual steps,
        or to modify steps based on user feedback.
    
        Each step dict: {action, skill, tool, params, rollback_tool?, rollback_params?}
        Use action="require_approval" for approval gates.
    
        Args:
            workflow_id: The draft workflow ID.
            name: Workflow name (optional, updates workflow_type).
            description: Human-readable description.
            steps: Complete list of steps (replaces all existing steps).
    
        Returns:
            Updated workflow summary for user review.
        """
        from vmware_pilot.models import WorkflowStep
    
        wf = _get_store().load(workflow_id)
        if not wf:
            return {"error": f"Workflow '{workflow_id}' not found"}
        if wf.state != WorkflowState.DRAFT:
            return {"error": f"Workflow '{workflow_id}' is not a draft (state: {wf.state.value})"}
    
        if name:
            wf.workflow_type = name
        if description:
            wf.params["description"] = description
    
        if steps is not None:
            wf.steps = [
                WorkflowStep(
                    index=i,
                    action=s.get("action", f"step_{i}"),
                    skill=s.get("skill", "unknown"),
                    tool=s.get("tool", "unknown"),
                    params=s.get("params", {}),
                    rollback_tool=s.get("rollback_tool", ""),
                    rollback_params=s.get("rollback_params", {}),
                )
                for i, s in enumerate(steps)
            ]
            wf.log("steps_updated", f"{len(steps)} steps")
    
        _get_store().save(wf)
    
        return {
            "workflow_id": wf.id,
            "workflow_type": wf.workflow_type,
            "state": "draft",
            "steps": [
                {"index": s.index, "action": s.action, "skill": s.skill, "tool": s.tool,
                 "has_rollback": bool(s.rollback_tool)}
                for s in wf.steps
            ],
            "message": "Draft updated. Show to user for review. Call confirm_draft() when approved.",
        }
Behavior4/5

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

Annotations indicate readOnlyHint=false, destructiveHint=false, idempotentHint=false, openWorldHint=true. Description adds that it returns a DRAFT workflow, outlines the interaction flow, and explains that the state becomes DRAFT. No contradiction with annotations.

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

Conciseness4/5

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

Description is well-structured with a clear tag, numbered flow, and separate args/returns sections. Slightly lengthy but each sentence adds value and it is front-loaded with purpose.

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

Completeness5/5

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

Covers purpose, when to use, design flow, parameter details, return structure (workflow_id, state, placeholder), and prerequisite use of get_skill_catalog(). No output schema but description provides sufficient context for a complex tool.

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

Parameters4/5

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

Schema has 0% description coverage; description explains 'goal' as natural language description and 'constraints' with examples. This adds meaning beyond schema titles and types, compensating for lack of schema descriptions.

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

Purpose5/5

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

The description clearly states it is for designing a workflow from a natural language description, with specific verb 'design' and resource 'workflow'. It distinguishes from siblings like 'plan_workflow' by outlining the draft-review-confirm-run flow.

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

Usage Guidelines4/5

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

Explicitly says 'Call this when the user describes a complex operation and you need to design a multi-step workflow.' Provides a numbered design flow and mentions using get_skill_catalog() first. Does not explicitly state when not to use, but context is clear.

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/zw008/VMware-Pilot'

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