Skip to main content
Glama

save_workflow

Store and organize creation workflows for future reuse, enabling consistent implementation of development processes.

Instructions

Save a creation workflow for reuse.

Args:
    name: Workflow name
    description: Workflow description
    steps: list of workflow steps

Returns:
    Confirmation message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
descriptionYes
stepsYes

Implementation Reference

  • main.py:248-279 (handler)
    MCP tool handler for 'save_workflow'. Registers the tool and implements the logic by delegating to the workflow_engine instance from the request context.
    @mcp.tool()
    async def save_workflow(
        ctx: Context,
        name: str,
        description: str,
        steps: list[dict],
    ) -> str:
        """
        Save a creation workflow for reuse.
    
        Args:
            name: Workflow name
            description: Workflow description
            steps: list of workflow steps
    
        Returns:
            Confirmation message
        """
        try:
            workflow_engine = ctx.request_context.lifespan_context["workflow_engine"]
    
            workflow_id = await workflow_engine.save_workflow(
                name=name,
                description=description,
                steps=steps,
            )
    
            return f"✅ Workflow '{name}' saved successfully (ID: {workflow_id})"
    
        except Exception as e:
            logger.error(f"Failed to save workflow: {e}")
            return f"❌ Error saving workflow: {str(e)}"
  • Core helper method in WorkflowEngine class that implements the actual workflow saving logic, including ID generation, object creation, in-memory storage, and persistence to disk.
    async def save_workflow(
        self,
        name: str,
        description: str,
        steps: list[dict[str, Any]],
    ) -> str:
        """Save workflow with automatic ID generation."""
        workflow_id = str(uuid4())[:8]
    
        # Convert step dictionaries to WorkflowStep objects
        workflow_steps = [WorkflowStep(**step) for step in steps]
    
        workflow = Workflow(
            name=name,
            description=description,
            steps=workflow_steps,
        )
    
        # Save to memory and disk
        self.workflows[workflow_id] = workflow
        await self._persist_workflow(workflow_id, workflow)
    
        logger.info(f"Saved workflow: {name} ({workflow_id})")
        return workflow_id
  • main.py:248-248 (registration)
    The @mcp.tool() decorator registers the save_workflow function as an MCP tool.
    @mcp.tool()

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/angrysky56/mcp-creator-mcp'

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