Skip to main content
Glama

list-variables

Retrieve all available variables from n8n workflows to access stored data and configuration values for automation processes.

Instructions

List all variables from n8n. NOTE: Requires n8n Enterprise license with variable management features enabled. Use after init-n8n to see available variables. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clientIdYes

Implementation Reference

  • The execution handler for the 'list-variables' MCP tool. It retrieves the stored N8nClient instance using the provided clientId, calls listVariables() on it, and returns the formatted list of variables as JSON or an error message.
    case "list-variables": {
      const { clientId } = args as { clientId: string };
      const client = clients.get(clientId);
      if (!client) {
        return {
          content: [{
            type: "text",
            text: "Client not initialized. Please run init-n8n first.",
          }],
          isError: true
        };
      }
    
      try {
        const variables = await client.listVariables();
        return {
          content: [{
            type: "text",
            text: JSON.stringify(variables.data, null, 2),
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: error instanceof Error ? error.message : "Unknown error occurred",
          }],
          isError: true
        };
      }
    }
  • Input schema for the 'list-variables' tool, defining the required 'clientId' parameter.
        type: "object",
        properties: {
          clientId: { type: "string" }
        },
        required: ["clientId"]
      }
    },
  • src/index.ts:616-626 (registration)
    Registration of the 'list-variables' tool in the listTools response. Includes name, description, and input schema.
      name: "list-variables",
      description: "List all variables from n8n. NOTE: Requires n8n Enterprise license with variable management features enabled. Use after init-n8n to see available variables. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.",
      inputSchema: {
        type: "object",
        properties: {
          clientId: { type: "string" }
        },
        required: ["clientId"]
      }
    },
    {
  • N8nClient helper method that performs the API request to '/variables' to list all variables.
    async listVariables(): Promise<N8nVariableList> {
      return this.makeRequest<N8nVariableList>('/variables');
    }
  • TypeScript interface definitions for N8nVariable and N8nVariableList used in the response typing for list-variables.
    interface N8nVariable {
      id: string;
      key: string;
      value: string;
      type?: string;
    }
    
    interface N8nVariableList {
      data: N8nVariable[];
      nextCursor?: string;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions license requirements and input formatting, which are useful behavioral traits. However, it doesn't describe the return format (e.g., list structure, pagination), error handling, or performance characteristics, leaving gaps for a tool with no annotation support.

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 critical notes in a logical order (prerequisites, usage sequence, technical details). Each sentence adds essential value without redundancy, making it highly efficient and well-structured for an AI agent.

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 tool's complexity (simple list operation), no annotations, and no output schema, the description is reasonably complete. It covers purpose, prerequisites, usage context, and input formatting. However, it lacks details on output structure and error cases, which would be beneficial for full contextual understanding.

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?

Schema description coverage is 0%, so the schema provides no parameter documentation. The description does not explain the 'clientId' parameter at all, leaving its purpose and format unspecified. However, since there is only one parameter, the baseline is 4, but the lack of any semantic information reduces it to 3, as the description fails to compensate for the schema gap.

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 verb 'List' and the resource 'all variables from n8n', making the purpose specific and unambiguous. It distinguishes itself from sibling tools like 'create-variable' and 'delete-variable' by focusing on retrieval rather than modification, and from 'get-variable' (which doesn't exist in the list) by implying a bulk operation.

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 usage guidance: it states prerequisites ('Requires n8n Enterprise license with variable management features enabled'), a recommended sequence ('Use after init-n8n to see available variables'), and technical constraints ('Arguments must be provided as compact, single-line JSON without whitespace or newlines'). This covers when to use it, dependencies, and how to format inputs.

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