Skip to main content
Glama

update-workflow

Modify existing n8n workflows by updating properties, nodes, or connections. Use this tool after retrieving a workflow to apply changes to automation processes.

Instructions

Update an existing workflow in n8n. Use after get-workflow to modify a workflow's properties, nodes, or connections. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clientIdYes
idYes
workflowYes

Implementation Reference

  • The MCP tool handler that processes the 'update-workflow' call, retrieves the N8nClient instance using clientId, and invokes the client's updateWorkflow method with the provided id and workflow updates.
    case "update-workflow": { const { clientId, id, workflow } = args as { clientId: string; id: string; workflow: Partial<N8nWorkflow>; }; const client = clients.get(clientId); if (!client) { return { content: [{ type: "text", text: "Client not initialized. Please run init-n8n first.", }], isError: true }; } try { const updatedWorkflow = await client.updateWorkflow(id, workflow); return { content: [{ type: "text", text: `Successfully updated workflow:\n${JSON.stringify(updatedWorkflow, null, 2)}`, }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }], isError: true }; } }
  • The N8nClient class method that sends a PUT request to the n8n API endpoint `/workflows/{id}` with the partial workflow update data.
    async updateWorkflow(id: string, workflow: Partial<N8nWorkflow>): Promise<N8nWorkflow> { return this.makeRequest<N8nWorkflow>(`/workflows/${id}`, { method: 'PUT', body: JSON.stringify(workflow), }); }
  • src/index.ts:450-470 (registration)
    The tool specification registered in the ListTools handler, defining the name, description, and input schema for 'update-workflow'.
    name: "update-workflow", description: "Update an existing workflow in n8n. Use after get-workflow to modify a workflow's properties, nodes, or connections. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" }, workflow: { type: "object", properties: { name: { type: "string" }, active: { type: "boolean" }, nodes: { type: "array" }, connections: { type: "object" }, settings: { type: "object" } } } }, required: ["clientId", "id", "workflow"] } },
  • TypeScript interface defining the structure of an n8n workflow object, used in the update-workflow tool's workflow parameter.
    interface N8nWorkflow { id: number; name: string; active: boolean; createdAt: string; updatedAt: string; tags: string[]; }

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

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