delete_workflow
Remove an n8n workflow from the testing environment using its ID to clean up test workflows and manage workflow inventory.
Instructions
Delete an n8n workflow by ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflowId | Yes |
Implementation Reference
- src/n8n-client.ts:120-128 (handler)The deleteWorkflow function makes a DELETE request to the n8n API to delete a workflow by ID. It constructs the API URL, sends the request with proper headers, and returns a confirmation object with deleted: true and the workflowId.
export async function deleteWorkflow(workflowId: string) { const { baseUrl } = getEnv(); const response = await fetch(`${baseUrl}/api/v1/workflows/${workflowId}`, { method: 'DELETE', headers: buildHeaders(), }); if (!response.ok) throw new Error(`n8n API returned ${response.status}`); return { deleted: true, workflowId }; } - src/index.ts:68-75 (registration)Tool registration for 'delete_workflow' with description 'Delete an n8n workflow by ID.' and input schema defining a required workflowId string property.
name: 'delete_workflow', description: 'Delete an n8n workflow by ID.', inputSchema: { type: 'object', properties: { workflowId: { type: 'string' } }, required: ['workflowId'], }, }, - src/index.ts:234-238 (handler)Handler for 'delete_workflow' tool calls - validates the workflowId argument using Zod schema, calls the deleteWorkflow function, and returns the result as JSON text content.
if (name === 'delete_workflow') { const { workflowId } = z.object({ workflowId: z.string() }).parse(args); const deleted = await deleteWorkflow(workflowId); return { content: [{ type: 'text', text: JSON.stringify(deleted, null, 2) }] }; }