Skip to main content
Glama

rollback_workflow

Restore a workflow to a previous version by specifying the workflow ID and target version. Enables precise version control and correction of errors in workflow executions.

Instructions

Rollback a workflow to a previous version

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
reasonNo
target_versionYes
workflow_idYes

Implementation Reference

  • The main handler function for the rollback_workflow tool. Parses input, fetches current and target workflows, performs rollback via storage, and returns success response with details.
    private async rollbackWorkflow(args: unknown) { const parsed = RollbackWorkflowSchema.parse(args); const workflow = await this.storage.get(parsed.workflow_id); if (!workflow) { throw new Error(`Workflow not found: ${parsed.workflow_id}`); } const targetWorkflow = await this.storage.getVersion(parsed.workflow_id, parsed.target_version); if (!targetWorkflow) { throw new Error(`Version ${parsed.target_version} not found for workflow ${parsed.workflow_id}`); } const success = await this.storage.rollback(parsed.workflow_id, parsed.target_version); if (!success) { throw new Error('Rollback failed'); } return { content: [ { type: 'text', text: JSON.stringify({ success: true, workflow_id: parsed.workflow_id, workflow_name: workflow.name, previous_version: workflow.version, rolled_back_to: parsed.target_version, reason: parsed.reason || 'No reason provided', message: `Successfully rolled back "${workflow.name}" from v${workflow.version} to v${parsed.target_version}`, }, null, 2), }, ], }; }
  • Zod schema defining the input parameters for rollback_workflow: workflow_id (required), target_version (required), reason (optional).
    const RollbackWorkflowSchema = z.object({ workflow_id: z.string(), target_version: z.string(), reason: z.string().optional(), });
  • src/index.ts:301-305 (registration)
    Tool registration in the getTools() method, specifying name, description, and input schema for the MCP tool list.
    { name: 'rollback_workflow', description: 'Rollback a workflow to a previous version', inputSchema: zodToJsonSchema(RollbackWorkflowSchema), },
  • src/index.ts:138-139 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes rollback_workflow calls to the rollbackWorkflow method.
    case 'rollback_workflow': return await this.rollbackWorkflow(args);

Other Tools

Related 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/FiveOhhWon/workflows-mcp'

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