list_all_users
Retrieve all accepted organization users with their IDs, names, emails, roles, and timestamps to get user IDs needed for user management actions.
Instructions
List accepted org users with id, name, email, role, and timestamps. Use this to find a user_id before get_user, update_user, delete_user, or add_workspace_member; use list_user_invites for pending invitations. Enterprise-gated. Returns 403 on non-Enterprise Portkey plans.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Whether the tool call succeeded and returned structured data | |
| data | No | Structured success payload when ok is true | |
| error | No | Structured error payload when ok is false |
Implementation Reference
- src/tools/users.tools.ts:189-211 (handler)The main handler for the 'list_all_users' tool. Calls service.users.listUsers(), formats results using the formatUser helper, and returns a JSON response with total count and user list.
server.tool( "list_all_users", "List accepted org users with id, name, email, role, and timestamps. Use this to find a user_id before get_user, update_user, delete_user, or add_workspace_member; use list_user_invites for pending invitations.", USERS_TOOL_SCHEMAS.listAllUsers, async () => { const users = await service.users.listUsers(); return { content: [ { type: "text", text: JSON.stringify( { total: users.total, users: users.data.map(formatUser), }, null, 2, ), }, ], }; }, ); - src/tools/users.tools.ts:11-11 (schema)Schema definition for list_all_users - an empty object (no input parameters required).
listAllUsers: {}, - src/tools/users.tools.ts:189-211 (registration)Registration of the 'list_all_users' tool on the MCP server via server.tool(), within the registerUsersTools function (called from src/tools/index.ts via TOOL_DOMAIN_REGISTRARS entry for 'users').
server.tool( "list_all_users", "List accepted org users with id, name, email, role, and timestamps. Use this to find a user_id before get_user, update_user, delete_user, or add_workspace_member; use list_user_invites for pending invitations.", USERS_TOOL_SCHEMAS.listAllUsers, async () => { const users = await service.users.listUsers(); return { content: [ { type: "text", text: JSON.stringify( { total: users.total, users: users.data.map(formatUser), }, null, 2, ), }, ], }; }, ); - src/tools/users.tools.ts:136-143 (helper)formatUser helper function that transforms a PortkeyUser into the output format (id, name, email, role, created_at, last_updated_at).
function formatUser(user: PortkeyUser): { id: string; name: string; email: string; role: string; created_at: string; last_updated_at: string; } { - The listUsers() method in UsersService class that makes a GET request to /admin/users endpoint to fetch all users from the Portkey API.
async listUsers(): Promise<PortkeyUsersResponse> { return this.get<PortkeyUsersResponse>("/admin/users"); }