delete-workflow
Remove a workflow permanently by its ID using the n8n MCP Server. This action cannot be undone, so ensure you have the correct workflow identification before proceeding.
Instructions
Delete a workflow by ID. This action cannot be undone. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientId | Yes | ||
| id | Yes |
Implementation Reference
- src/index.ts:1035-1065 (handler)The execution handler for the 'delete-workflow' tool within the CallToolRequestSchema switch statement. It retrieves the N8nClient instance, calls deleteWorkflow(id), and returns success or error response.case "delete-workflow": { const { clientId, id } = args as { clientId: string; id: string }; const client = clients.get(clientId); if (!client) { return { content: [{ type: "text", text: "Client not initialized. Please run init-n8n first.", }], isError: true }; } try { const workflow = await client.deleteWorkflow(id); return { content: [{ type: "text", text: `Successfully deleted workflow:\n${JSON.stringify(workflow, null, 2)}`, }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }], isError: true }; } }
- src/index.ts:471-482 (registration)Registration of the 'delete-workflow' tool in the ListToolsRequestSchema handler, specifying name, description, and input schema.{ name: "delete-workflow", description: "Delete a workflow by ID. This action cannot be undone. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] } },
- src/index.ts:186-190 (helper)N8nClient helper method that performs the actual DELETE API request to /workflows/{id}.async deleteWorkflow(id: string): Promise<N8nWorkflow> { return this.makeRequest<N8nWorkflow>(`/workflows/${id}`, { method: 'DELETE', }); }
- src/index.ts:474-481 (schema)Input schema definition for the 'delete-workflow' tool, specifying required parameters clientId and id.inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] }