delete_workflow
Remove workflows from n8n automation platform using workflow ID to manage automation lifecycle and maintain clean workflow inventory.
Instructions
Delete an n8n workflow
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/index.ts:414-417 (handler)The primary handler function for the 'delete_workflow' tool. It resolves the workflow ID using an alias mapping if applicable, calls the N8nClient's deleteWorkflow method, and returns a success response with the original ID.private async handleDeleteWorkflow(args: { id: string | number }) { const id = this.resolveWorkflowId(args.id); await this.n8nClient.deleteWorkflow(id); return { content: [{ type: 'text', text: JSON.stringify(jsonSuccess({ id: args.id }), null, 2) }] };
- src/index.ts:73-73 (registration)Registers the 'delete_workflow' tool in the MCP server's tool list, including its name, description, and input schema defining the required 'id' parameter.{ name: 'delete_workflow', description: 'Delete an n8n workflow', inputSchema: { type: 'object', properties: { id: { oneOf: [{ type: 'string' }, { type: 'number' }] } }, required: ['id'] } },
- src/index.ts:73-73 (schema)Defines the input schema for the 'delete_workflow' tool, specifying an object with a required 'id' field that can be string or number.{ name: 'delete_workflow', description: 'Delete an n8n workflow', inputSchema: { type: 'object', properties: { id: { oneOf: [{ type: 'string' }, { type: 'number' }] } }, required: ['id'] } },
- src/n8n-client.ts:217-219 (helper)Helper method in N8nClient that performs the actual HTTP DELETE request to the n8n API endpoint `/workflows/{id}` to delete the workflow.async deleteWorkflow(id: string | number): Promise<void> { await this.api.delete(`/workflows/${id}`); }