Skip to main content
Glama
Livus-AI
by Livus-AI

delete_workflow

Remove a workflow script from the Workflows MCP Server to manage automation processes by deleting specific workflows.

Instructions

Delete a workflow script.

Args:
    name: The name of the workflow to delete

Returns:
    dict: Status of the operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Implementation Reference

  • Primary MCP tool handler for 'delete_workflow'. Sanitizes the workflow name, resolves the file path, checks existence, deletes the file, and returns status.
    @mcp.tool()
    def delete_workflow(name: str) -> dict:
        """
        Delete a workflow script.
        
        Args:
            name: The name of the workflow to delete
        
        Returns:
            dict: Status of the operation
        """
        try:
            workflow_path = get_workflow_path(name)
            
            if not workflow_path.exists():
                return {
                    "status": "error",
                    "message": f"Workflow '{name}' not found"
                }
            
            workflow_path.unlink()
            
            return {
                "status": "success",
                "message": f"Workflow '{name}' deleted successfully"
            }
        except Exception as e:
            return {
                "status": "error",
                "message": f"Failed to delete workflow: {str(e)}"
            }
  • Helper function used by delete_workflow to compute the sanitized file path in the workflows directory.
    def get_workflow_path(name: str) -> Path:
        """Get the full path for a workflow file."""
        # Sanitize the name to prevent directory traversal
        safe_name = "".join(c for c in name if c.isalnum() or c in "_-").lower()
        return Path(WORKFLOWS_DIR) / f"{safe_name}.py"
  • Explicit JSON input schema for the delete_workflow tool, defining the required 'name' parameter.
    {
        "name": "delete_workflow",
        "description": "Delete a workflow script.",
        "inputSchema": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string",
                    "description": "The name of the workflow to delete"
                }
            },
            "required": ["name"]
        }
  • HTTP MCP server handler for delete_workflow tool call.
    def tool_delete_workflow(arguments: dict) -> dict:
        """Delete a workflow."""
        try:
            name = arguments.get("name")
            
            if not name:
                return {"error": "Workflow name is required"}
            
            workflow_path = get_workflow_path(name)
            
            if not workflow_path.exists():
                return {"error": f"Workflow '{name}' not found"}
            
            workflow_path.unlink()
            
            return {"status": "success", "message": f"Workflow '{name}' deleted successfully"}
        except Exception as e:
            return {"error": str(e)}
  • Registration of the delete_workflow handler in the TOOL_HANDLERS dictionary.
    "delete_workflow": tool_delete_workflow,

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/Livus-AI/Workflows-MCP'

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