delete_workflow
Delete a n8n workflow by providing its unique ID, removing it permanently from your instance.
Instructions
Delete a workflow
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflowId | Yes | The ID of the workflow to delete |
Implementation Reference
- src/tools.ts:119-132 (schema)Tool registration/schema for 'delete_workflow': defines the tool name, description, and input schema (requiring workflowId as a string).
{ name: "delete_workflow", description: "Delete a workflow", inputSchema: { type: "object", properties: { workflowId: { type: "string", description: "The ID of the workflow to delete", }, }, required: ["workflowId"], }, }, - src/handlers.ts:95-98 (handler)Handler for 'delete_workflow': parses args using WorkflowIdSchema (z.object with workflowId string), then calls client.deleteWorkflow(workflowId).
case "delete_workflow": { const { workflowId } = WorkflowIdSchema.parse(args); return await client.deleteWorkflow(workflowId); } - src/n8n-client.ts:86-89 (helper)N8nClient.deleteWorkflow() method: makes an HTTP DELETE call to /api/v1/workflows/{id} and returns a success message.
async deleteWorkflow(id: string) { await this.client.delete(`/api/v1/workflows/${id}`); return { success: true, message: `Workflow ${id} deleted successfully` }; } - src/handlers.ts:12-14 (schema)WorkflowIdSchema Zod schema used for validation: expects a string property 'workflowId'.
const WorkflowIdSchema = z.object({ workflowId: z.string(), }); - src/index.ts:37-40 (registration)MCP server registration: CallToolRequestSchema handler receives tool calls and dispatches to handleToolCall, which routes 'delete_workflow' to the correct case.
server.setRequestHandler(CallToolRequestSchema, async (request) => { try { const { name, arguments: args } = request.params; const result = await handleToolCall(name, args, n8nClient);