Skip to main content
Glama

create-user

Add a new user to a Keycloak realm by providing required details like username, email, and name.

Instructions

Create a new user in a specific realm

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
realmYes
usernameYes
emailYes
firstNameYes
lastNameYes

Implementation Reference

  • Implements the 'create-user' tool handler: parses arguments with CreateUserSchema, sets Keycloak realm config, creates user via admin client, returns success with user ID.
    case "create-user": {
      const { realm, username, email, firstName, lastName } = CreateUserSchema.parse(args);
      
      kcAdminClient.setConfig({
        realmName: realm
      });
    
      const user = await kcAdminClient.users.create({
        realm,
        username,
        email,
        firstName,
        lastName,
        enabled: true
      });
    
      return {
        content: [{
          type: "text",
          text: `User created successfully. User ID: ${user.id}`
        }]
      };
    }
  • Zod schema defining input validation for create-user tool parameters.
    const CreateUserSchema = z.object({
      realm: z.string(),
      username: z.string(),
      email: z.string().email(),
      firstName: z.string(),
      lastName: z.string()
    });
  • src/index.ts:47-61 (registration)
    Tool registration in the listTools response, defining name, description, and input schema for 'create-user'.
    {
      name: "create-user",
      description: "Create a new user in a specific realm",
      inputSchema: {
        type: "object",
        properties: {
          realm: { type: "string" },
          username: { type: "string" },
          email: { type: "string", format: "email" },
          firstName: { type: "string" },
          lastName: { type: "string" }
        },
        required: ["realm", "username", "email", "firstName", "lastName"]
      }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool creates a user, implying a write/mutation operation, but doesn't disclose any behavioral traits such as permissions required, whether the operation is idempotent, error handling, or what happens on success/failure. This leaves significant gaps for an agent to understand how to use it safely and effectively.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that is front-loaded with the core action. There is no wasted verbiage or unnecessary elaboration, making it highly efficient and easy to parse. Every word earns its place by conveying essential information without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a user creation tool with 5 required parameters, no annotations, and no output schema, the description is incomplete. It lacks details on behavioral aspects, parameter usage, and expected outcomes. While concise, it doesn't provide enough context for an agent to confidently invoke the tool without additional assumptions or errors.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate by explaining parameters, but it adds no meaning beyond the schema. The description mentions 'realm' but doesn't clarify what a realm is or how parameters like 'username' or 'email' are used. With 5 required parameters and no guidance in the description, this is inadequate for understanding parameter roles.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('new user in a specific realm'), making the purpose immediately understandable. It distinguishes from sibling tools like 'delete-user' and 'list-users' by specifying creation rather than deletion or listing. However, it doesn't specify what kind of user or system this applies to, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing realm access), when not to use it (e.g., for existing users), or direct alternatives among siblings. The phrase 'in a specific realm' hints at context but lacks explicit usage instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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