Skip to main content
Glama

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

Implementation Reference

  • 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
        };
      }
    }
  • 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"]
      }
    },
  • 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',
      });

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively communicates critical traits: the action is irreversible ('This action cannot be undone'), and there are specific input formatting requirements ('Arguments must be provided as compact, single-line JSON without whitespace or newlines'). However, it does not mention potential side effects, error conditions, or response format, leaving some behavioral aspects unclear.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose, followed by important notes and requirements. Each sentence serves a distinct purpose: stating the action, noting prerequisites, guiding usage, warning about irreversibility, and specifying input format. There is no redundant or unnecessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a destructive operation with no annotations and no output schema, the description does well by covering key aspects like prerequisites, usage context, and irreversibility. However, it lacks details on error handling, response structure, or what happens to dependent resources, which would be valuable for a deletion tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, so the description must compensate. It mentions 'ID' as a parameter, which aligns with the 'id' property in the schema, but does not explain the 'clientId' parameter or provide any additional semantic context for either parameter. The baseline is 3 because the description adds minimal value beyond the schema's structural information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Delete') and resource ('a variable by ID'), making the purpose specific and unambiguous. It distinguishes from sibling tools like 'list-variables' and 'create-variable' by focusing on deletion rather than listing or creation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool: 'Use after list-variables to get the ID of the variable to delete.' It also mentions prerequisites ('Requires n8n Enterprise license with variable management features enabled'), which helps the agent understand necessary conditions before invocation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.