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
| Name | Required | Description | Default |
|---|---|---|---|
| reason | No | ||
| target_version | Yes | ||
| workflow_id | Yes |
Implementation Reference
- src/index.ts:893-927 (handler)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), }, ], }; }
- src/index.ts:80-84 (schema)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);