Skip to main content
Glama

update_workflow

Modify existing n8n workflows by updating workflow name, nodes, connections, activation status, or tags through the n8n API.

Instructions

Update an existing n8n workflow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
activeNo
connectionsNo
idYes
ifMatchNoOptional If-Match header value for optimistic concurrency control
nameNo
nodesNo
tagsNo

Implementation Reference

  • Primary MCP tool handler for 'update_workflow': resolves workflow ID alias, calls N8nClient.updateWorkflow, adds numeric ID alias, and formats response.
    private async handleUpdateWorkflow(args: { id: string | number; ifMatch?: string } & Partial<N8nWorkflow>) { const { id, ifMatch, ...updateData } = args; const resolvedId = this.resolveWorkflowId(id); const workflow = await this.n8nClient.updateWorkflow(resolvedId, updateData, ifMatch); this.withAlias(workflow); return { content: [{ type: 'text', text: JSON.stringify(jsonSuccess(workflow), null, 2) }] };
  • src/index.ts:72-72 (registration)
    Tool registration in ListTools response, defining name, description, and input schema validation.
    { name: 'update_workflow', description: 'Update an existing n8n workflow', inputSchema: { type: 'object', properties: { id: { oneOf: [{ type: 'string' }, { type: 'number' }] }, name: { type: 'string' }, nodes: { type: 'array', items: { type: 'object' } }, connections: { type: 'object' }, active: { type: 'boolean' }, tags: { type: 'array', items: { type: 'string' } }, ifMatch: { type: 'string', description: 'Optional If-Match header value for optimistic concurrency control' } }, required: ['id'] } },
  • Core N8nClient method implementing the workflow update: resolves credential aliases, performs PUT /workflows/{id} API call with optional If-Match concurrency control.
    async updateWorkflow(id: string | number, workflow: Partial<N8nWorkflow>, ifMatch?: string): Promise<N8nWorkflow> { // Resolve credential aliases before updating the workflow await this.resolveCredentialsInWorkflow(workflow); const headers: Record<string, string> = {}; // Allow 'active' to be updated via standard update to support tests and API compatibility if (ifMatch) headers['If-Match'] = ifMatch; try { const response = await this.api.put<N8nApiResponse<N8nWorkflow> | N8nWorkflow>(`/workflows/${id}`, workflow, { headers }); const payload: any = response.data as any; return (payload && typeof payload === 'object' && 'data' in payload) ? payload.data : payload; } catch (error: any) { if (error.response?.status === 412) { throw new Error( 'Precondition failed: The workflow has been modified by another user. Please fetch the latest version and try again.', ); } throw error; } }

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/get2knowio/n8n-mcp'

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