Skip to main content
Glama

update_workflow

Modify an existing workflow by applying specified updates and optionally incrementing its version, enabling efficient workflow management and adaptation.

Instructions

Update an existing workflow with optional version increment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
increment_versionNo
updatesYes

Implementation Reference

  • The main handler function that parses input, fetches the workflow, validates updates, applies them, optionally increments version, re-validates, saves, and returns success response.
    private async updateWorkflow(args: unknown) { const parsed = UpdateWorkflowSchema.parse(args); const workflow = await this.storage.get(parsed.id); if (!workflow) { throw new Error(`Workflow not found: ${parsed.id}`); } // Validate partial update const validation = WorkflowValidator.validatePartialWorkflow(parsed.updates); if (!validation.success) { throw new Error(`Validation failed: ${validation.error}`); } // Apply updates const updatedWorkflow = { ...workflow, ...parsed.updates, id: workflow.id, // Prevent ID change metadata: { created_at: workflow.metadata?.created_at || new Date().toISOString(), updated_at: new Date().toISOString(), times_run: workflow.metadata?.times_run || 0, created_by: workflow.metadata?.created_by, average_duration_ms: workflow.metadata?.average_duration_ms, success_rate: workflow.metadata?.success_rate, last_run_at: workflow.metadata?.last_run_at, }, }; // Increment version if requested if (parsed.increment_version) { const [major, minor, patch] = updatedWorkflow.version.split('.').map(Number); updatedWorkflow.version = `${major}.${minor}.${patch + 1}`; } // Validate complete workflow const fullValidation = WorkflowValidator.validateWorkflow(updatedWorkflow); if (!fullValidation.success) { throw new Error(`Validation failed: ${fullValidation.error}`); } // Save await this.storage.save(updatedWorkflow); return { content: [ { type: 'text', text: JSON.stringify({ success: true, workflow_id: parsed.id, version: updatedWorkflow.version, message: `Workflow "${updatedWorkflow.name}" updated successfully`, }, null, 2), }, ], }; }
  • Zod schema defining input for update_workflow: workflow ID, updates object, and optional version increment flag.
    const UpdateWorkflowSchema = z.object({ id: z.string(), updates: z.record(z.any()), increment_version: z.boolean().optional(), });
  • src/index.ts:267-271 (registration)
    Tool registration in getTools() method, defining name, description, and input schema.
    { name: 'update_workflow', description: 'Update an existing workflow with optional version increment', inputSchema: zodToJsonSchema(UpdateWorkflowSchema), },
  • src/index.ts:128-129 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes to the updateWorkflow method.
    case 'update_workflow': return await this.updateWorkflow(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