Skip to main content
Glama

list-users

Retrieve all users within a specified Keycloak realm to manage user accounts and access permissions.

Instructions

List users in a specific realm

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
realmYes

Implementation Reference

  • The handler function for the 'list-users' tool. It parses the input arguments using ListUsersSchema, configures the Keycloak client for the specified realm, fetches the list of users using kcAdminClient.users.find(), and returns a formatted text response listing the users with their usernames and IDs.
    case "list-users": { const { realm } = ListUsersSchema.parse(args); kcAdminClient.setConfig({ realmName: realm }); const users = await kcAdminClient.users.find(); return { content: [{ type: "text", text: `Users in realm ${realm}:\n${users.map(u => `- ${u.username} (${u.id})`).join('\n')}` }] }; }
  • Zod schema for validating the input parameters of the 'list-users' tool, requiring a 'realm' string.
    const ListUsersSchema = z.object({ realm: z.string() });
  • src/index.ts:83-93 (registration)
    The tool registration entry for 'list-users' in the listTools response, including name, description, and inputSchema matching the ListUsersSchema.
    { name: "list-users", description: "List users in a specific realm", inputSchema: { type: "object", properties: { realm: { type: "string" } }, required: ["realm"] } }
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ChristophEnglisch/keycloak-model-context-protocol'

If you have feedback or need assistance with the MCP directory API, please join our Discord server