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

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