list-users
Retrieve all users from your n8n instance. This tool is available exclusively for instance owners to manage user access and permissions.
Instructions
Retrieve all users from your instance. Only available for the instance owner.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientId | Yes |
Implementation Reference
- src/index.ts:1259-1288 (handler)Handler for the 'list-users' tool in the CallToolRequestSchema switch statement. Retrieves the N8nClient instance by clientId and calls listUsers() on it, returning the formatted user list or error.case "list-users": { 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 users = await client.listUsers(); return { content: [{ type: "text", text: JSON.stringify(users.data, null, 2), }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }], isError: true }; }
- src/index.ts:555-565 (registration)Registration of the 'list-users' tool in the ListToolsRequestSchema handler's tools array, defining name, description, and input schema.{ name: "list-users", description: "Retrieve all users from your instance. Only available for the instance owner.", inputSchema: { type: "object", properties: { clientId: { type: "string" } }, required: ["clientId"] } },
- src/index.ts:8-22 (schema)TypeScript interfaces defining the structure of N8nUser and N8nUserList for input/output validation in the list-users tool.interface N8nUser { id: string; email: string; firstName?: string; lastName?: string; isPending: boolean; role?: string; createdAt: string; updatedAt: string; } interface N8nUserList { data: N8nUser[]; nextCursor?: string; }
- src/index.ts:230-232 (helper)N8nClient.listUsers() helper method that performs the API request to '/users' endpoint to fetch the list of users.async listUsers(): Promise<N8nUserList> { return this.makeRequest<N8nUserList>('/users'); }