delete-execution
Remove a specific workflow execution by ID from the n8n MCP Server, ensuring precise management of workflow history and resources. Requires client ID and execution ID for targeted deletion.
Instructions
Delete a specific execution by ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientId | Yes | ||
| id | Yes |
Implementation Reference
- src/index.ts:1661-1691 (handler)The main handler for the 'delete-execution' MCP tool. It extracts clientId and execution id from arguments, retrieves the N8nClient instance, calls deleteExecution(id), and returns success or error response.case "delete-execution": { const { clientId, id } = args as { clientId: string; id: number }; const client = clients.get(clientId); if (!client) { return { content: [{ type: "text", text: "Client not initialized. Please run init-n8n first.", }], isError: true }; } try { const execution = await client.deleteExecution(id); return { content: [{ type: "text", text: `Successfully deleted execution:\n${JSON.stringify(execution, null, 2)}`, }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }], isError: true }; } }
- src/index.ts:722-731 (schema)Input schema and metadata for the 'delete-execution' tool, defined in the ListTools response. Specifies required parameters: clientId (string) and id (number).name: "delete-execution", description: "Delete a specific execution by ID.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "number" } }, required: ["clientId", "id"] }
- src/index.ts:722-731 (registration)Registration of the 'delete-execution' tool in the list of available tools returned by ListToolsRequestHandler.name: "delete-execution", description: "Delete a specific execution by ID.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "number" } }, required: ["clientId", "id"] }
- src/index.ts:292-296 (helper)Core implementation in N8nClient class: sends DELETE request to n8n REST API endpoint `/executions/${id}` to delete the execution.async deleteExecution(id: number): Promise<N8nExecution> { return this.makeRequest<N8nExecution>(`/executions/${id}`, { method: 'DELETE', }); }