rollback_workflow
Revert a workflow to an earlier version by specifying the workflow ID and target version. Use this tool to restore previous configurations when needed.
Instructions
Rollback a workflow to a previous version
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflow_id | Yes | ||
| target_version | Yes | ||
| reason | No |
Implementation Reference
- src/index.ts:893-927 (handler)Main handler function for rollback_workflow tool. Parses input using RollbackWorkflowSchema, validates existence of current and target workflow versions via storage, executes rollback, and returns formatted success response with details including previous and new versions.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), }, ], }; }
- src/index.ts:80-84 (schema)Zod schema defining the input structure for rollback_workflow: workflow_id (string, required), target_version (string, required), reason (string, 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 getTools() method, defining the rollback_workflow tool's name, description, and converting the Zod schema to JSON schema for MCP protocol compliance.{ name: 'rollback_workflow', description: 'Rollback a workflow to a previous version', inputSchema: zodToJsonSchema(RollbackWorkflowSchema), },
- src/index.ts:138-139 (registration)Dispatch case in the main CallToolRequestSchema handler that routes rollback_workflow calls to the specific rollbackWorkflow method.case 'rollback_workflow': return await this.rollbackWorkflow(args);