Skip to main content
Glama
DrBalls

n8n MCP Server

by DrBalls

List n8n Variables

n8n_list_variables
Read-onlyIdempotent

Retrieve environment variables from n8n workflows to access stored configuration data using pagination controls.

Instructions

List all environment variables.

Variables are accessible in workflows using $vars.variableName syntax.

Args:

  • limit (number): Maximum results (default: 100)

  • cursor (string, optional): Pagination cursor

Returns: List of variables with id, key, and value.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum results to return
cursorNoPagination cursor

Implementation Reference

  • The implementation of the `n8n_list_variables` tool, including tool registration, input schema validation, and the handler function that calls the n8n API to list variables.
      server.registerTool(
        'n8n_list_variables',
        {
          title: 'List n8n Variables',
          description: `List all environment variables.
    
    Variables are accessible in workflows using $vars.variableName syntax.
    
    Args:
      - limit (number): Maximum results (default: 100)
      - cursor (string, optional): Pagination cursor
    
    Returns:
      List of variables with id, key, and value.`,
          inputSchema: ListVariablesSchema,
          annotations: {
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: false
          }
        },
        async (params: z.infer<typeof ListVariablesSchema>) => {
          const queryParams: Record<string, unknown> = { limit: params.limit };
          if (params.cursor) queryParams.cursor = params.cursor;
          
          const response = await get<N8nPaginatedResponse<N8nVariable>>('/variables', queryParams);
          
          const formatted = response.data.map(formatVariable).join('\n');
          const output = {
            count: response.data.length,
            variables: response.data,
            nextCursor: response.nextCursor
          };
          
          let text = `Found ${response.data.length} variable(s):\n\n${formatted}`;
          if (response.nextCursor) {
            text += `\n\n_More results available. Use cursor: ${response.nextCursor}_`;
          }
          
          return {
            content: [{ type: 'text', text }],
            structuredContent: output
          };
        }
      );
Behavior3/5

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

Annotations already provide comprehensive behavioral hints (readOnlyHint, openWorldHint, idempotentHint, destructiveHint), so the description doesn't need to repeat safety information. It adds useful context about variable accessibility syntax and pagination behavior, but doesn't disclose additional traits like rate limits or authentication requirements beyond what annotations cover.

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

Conciseness4/5

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

The description is well-structured with clear sections (purpose, syntax context, Args, Returns) and appropriately sized. Every sentence serves a purpose, though the parameter restatement in 'Args' is somewhat redundant given the comprehensive schema documentation.

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?

For a read-only listing tool with comprehensive annotations and full parameter documentation, the description provides adequate context. It explains the resource being listed, includes syntax context, and describes the return format. The main gap is the lack of an output schema, but the description compensates by specifying what fields are returned.

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?

With 100% schema description coverage, the input schema already fully documents both parameters (limit and cursor). The description adds minimal value by restating parameter purposes in the 'Args' section without providing additional syntax, format, or usage details beyond what the schema already specifies.

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 resource 'all environment variables', making the purpose specific. It distinguishes from siblings like 'n8n_get_variable' (singular retrieval) and 'n8n_create_variable' (creation), establishing its role as a bulk listing operation.

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

Usage Guidelines4/5

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

The description provides clear context by mentioning that variables are accessible in workflows using $vars.variableName syntax, which helps users understand when this tool is relevant. However, it doesn't explicitly state when to use this tool versus alternatives like 'n8n_get_variable' or 'n8n_create_variable', missing explicit comparison guidance.

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

Install Server

Other Tools

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/DrBalls/n8n-mcp-server-v2'

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