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
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum results to return | |
| cursor | No | Pagination cursor |
Implementation Reference
- src/tools/variables.ts:26-71 (handler)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 }; } );