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
| Name | Required | Description | Default |
|---|---|---|---|
| clientId | Yes |
Implementation Reference
- src/index.ts:1393-1423 (handler)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 }; } } - src/index.ts:619-625 (schema)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"] } }, { - src/index.ts:252-254 (helper)N8nClient helper method that performs the API request to '/variables' to list all variables.
async listVariables(): Promise<N8nVariableList> { return this.makeRequest<N8nVariableList>('/variables'); } - src/index.ts:49-59 (schema)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; }