cortex_list_users
List all users across organizations using a superadmin API key for centralized user management.
Instructions
List all users across organizations (requires superadmin API key via CORTEX_SUPERADMIN_KEY)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/users.ts:13-57 (handler)The handler function for cortex_list_users tool. It checks if superadmin access is available, calls client.listUsers(), maps results to a summary, and returns the JSON response or an error.
async () => { try { if (!client.superadminAvailable) { return { content: [ { type: "text" as const, text: "User listing across organizations requires CORTEX_SUPERADMIN_KEY environment variable to be set.", }, ], isError: true, }; } const users = await client.listUsers(); const summary = users.map((u) => ({ id: u.id, name: u.name, organization: u.organization, roles: u.roles, status: u.status, hasKey: u.hasKey, hasPassword: u.hasPassword, })); return { content: [ { type: "text" as const, text: JSON.stringify(summary, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text" as const, text: `Error listing users: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }, - src/tools/users.ts:12-12 (schema)The schema for cortex_list_users: an empty object {} since there are no input parameters.
{}, - src/tools/users.ts:9-9 (registration)Registration of the tool via server.tool() call with the name 'cortex_list_users' and description 'List all users across organizations (requires superadmin API key via CORTEX_SUPERADMIN_KEY)'.
server.tool( - src/index.ts:44-44 (registration)The call to registerUserTools(server, client) in the main entry point which registers cortex_list_users along with other user tools.
registerUserTools(server, client); - src/client.ts:394-396 (helper)The client.listUsers() method that makes the actual HTTP request to the Cortex API endpoint /user using superadmin auth.
async listUsers(): Promise<CortexUser[]> { return this.request<CortexUser[]>("/user", {}, true); }