Skip to main content
Glama
DrBalls

n8n MCP Server

by DrBalls

n8n_list_variables

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
          };
        }
      );

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