Skip to main content
Glama

update_workflow

Modify existing workflows by applying changes to their configuration and optionally incrementing version numbers for version control.

Instructions

Update an existing workflow with optional version increment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
updatesYes
increment_versionNo

Implementation Reference

  • The primary handler function for the 'update_workflow' tool. Parses input arguments, retrieves the existing workflow from storage, validates partial updates, merges updates while preserving ID and updating metadata, optionally increments the semantic version, fully validates the updated workflow, saves it, and returns a JSON success response with the workflow ID and new version.
    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 input validation schema for the 'update_workflow' tool, requiring a workflow 'id' (string), 'updates' as a flexible record/object of changes, and optional 'increment_version' boolean flag.
    const UpdateWorkflowSchema = z.object({
      id: z.string(),
      updates: z.record(z.any()),
      increment_version: z.boolean().optional(),
    });
  • src/index.ts:268-271 (registration)
    MCP tool registration object in the getTools() array, specifying the tool name, description, and input schema converted to JSON schema format for the Model Context Protocol.
      name: 'update_workflow',
      description: 'Update an existing workflow with optional version increment',
      inputSchema: zodToJsonSchema(UpdateWorkflowSchema),
    },
  • src/index.ts:128-129 (registration)
    Switch case dispatcher in the CallToolRequestSchema handler that routes incoming 'update_workflow' tool calls to the private updateWorkflow method.
    case 'update_workflow':
      return await this.updateWorkflow(args);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'optional version increment,' hinting at mutability and version control, but lacks critical details: required permissions, whether updates are reversible, rate limits, or what happens to unspecified fields. For a mutation tool, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('Update an existing workflow') and adds a key feature ('optional version increment'). There's no wasted text, though it could be more structured with brief usage hints.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (mutation with 3 parameters, nested objects, no output schema, and no annotations), the description is incomplete. It doesn't cover behavioral aspects like permissions or side effects, parameter details beyond basics, or output expectations, making it inadequate for safe and effective use by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter details. The description adds minimal semantics: it implies 'id' identifies the workflow and 'updates' contains modifications, and mentions 'increment_version' as optional. However, it doesn't explain the structure of 'updates' (a nested object with no schema), acceptable values, or the effect of version increment, failing to compensate for the low coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Update') and resource ('an existing workflow'), specifying it modifies an existing entity rather than creating a new one. It distinguishes from siblings like 'create_workflow' by focusing on updates, though it doesn't explicitly contrast with other update-related tools like 'rollback_workflow'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing workflow ID), exclusions, or comparisons to siblings like 'rollback_workflow' for version management or 'create_workflow' for new workflows.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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