Skip to main content
Glama

delete-variable

Remove a specific variable by ID in n8n workflows using the MCP server. Requires n8n Enterprise license and variable ID obtained from list-variables. Action is irreversible.

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
NameRequiredDescriptionDefault
clientIdYes
idYes

Implementation Reference

  • MCP tool handler for 'delete-variable': validates clientId, retrieves N8nClient, calls deleteVariable(id), handles errors and success response.
    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:639-650 (registration)
    Registration of 'delete-variable' tool in the server's listTools response, defining 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"] } },
  • Input schema for 'delete-variable' tool: requires clientId and id as strings.
    inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] }
  • N8nClient helper method to delete a variable by ID via DELETE /variables/{id} API call.
    async deleteVariable(id: string): Promise<void> { return this.makeRequest<void>(`/variables/${id}`, { method: 'DELETE', }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/illuminaresolutions/n8n-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server