list_variables
Retrieve all workflow variables with pagination support to manage and access configuration data across n8n automation workflows.
Instructions
List all variables with pagination support
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | ||
| limit | No |
Implementation Reference
- src/index.ts:463-466 (handler)The main handler function for the 'list_variables' MCP tool. It calls the N8nClient's listVariables method with pagination parameters and returns a formatted JSON response.private async handleListVariables(args?: { limit?: number; cursor?: string }) { const response = await this.n8nClient.listVariables(args?.limit, args?.cursor); return { content: [{ type: 'text', text: JSON.stringify(jsonSuccess(response), null, 2) }] }; }
- src/index.ts:184-184 (registration)Registration of the 'list_variables' tool in the MCP server's ListTools response, including the tool name, description, and input schema definition.{ name: 'list_variables', description: 'List all variables with pagination support', inputSchema: { type: 'object', properties: { limit: { type: 'number' }, cursor: { type: 'string' } } } },
- src/n8n-client.ts:709-716 (helper)Underlying N8nClient helper method that makes the HTTP GET request to the n8n /variables API endpoint with optional pagination parameters.async listVariables(limit?: number, cursor?: string): Promise<N8nVariablesListResponse> { const params = new URLSearchParams(); if (limit) params.append('limit', limit.toString()); if (cursor) params.append('cursor', cursor); const url = params.toString() ? `/variables?${params.toString()}` : '/variables'; const response = await this.api.get<N8nVariablesListResponse>(url); return response.data; }
- src/index.ts:279-280 (handler)Dispatch logic in the main CallToolRequestHandler switch statement that routes 'list_variables' calls to the dedicated handler function.case 'list_variables': return await this.handleListVariables(request.params.arguments as { limit?: number; cursor?: string });