delete-variable
Remove a variable from n8n workflows by specifying its ID. Requires n8n Enterprise license with variable management enabled. Use after listing variables to identify the correct ID. This action is permanent and cannot be reversed.
Instructions
Delete a variable by ID. NOTE: Requires n8n Enterprise license with variable management features enabled. Use after list-variables to get the ID of the variable to delete. 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:1457-1487 (handler)MCP tool handler for 'delete-variable' that retrieves the N8nClient by clientId and calls its deleteVariable method to delete the variable by ID via the n8n API.case "delete-variable": { 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 { await client.deleteVariable(id); return { content: [{ type: "text", text: `Successfully deleted variable with ID: ${id}`, }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }], isError: true }; } }
- src/index.ts:642-649 (schema)Input schema definition for the delete-variable tool, specifying clientId and id as required string parameters.inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] }
- src/index.ts:639-650 (registration)Registration of the 'delete-variable' tool in the ListToolsRequestSchema handler's tools array, including name, description, and input schema.{ name: "delete-variable", description: "Delete a variable by ID. NOTE: Requires n8n Enterprise license with variable management features enabled. Use after list-variables to get the ID of the variable to delete. 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:262-266 (helper)N8nClient helper method that makes a DELETE request to the n8n API endpoint /variables/{id} to delete the specified variable.async deleteVariable(id: string): Promise<void> { return this.makeRequest<void>(`/variables/${id}`, { method: 'DELETE', });