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"]
      }
    },

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.0.0

TDQS

C2.8/5.0
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 'Create' which implies a write/mutation operation, but doesn't mention permissions required, whether the operation is idempotent, what happens on duplicate entries, or any rate limits. This leaves significant gaps for a mutation tool.

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, efficient sentence with zero wasted words. It's appropriately sized and front-loaded with the core purpose, making it easy to parse quickly.

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?

For a mutation tool with 5 parameters, 0% schema coverage, no annotations, and no output schema, the description is inadequate. It doesn't explain what happens after creation (e.g., returns user ID), error conditions, or behavioral nuances, leaving too many unknowns for effective tool use.

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?

The schema has 5 parameters with 0% description coverage, so the description must compensate. However, it only mentions 'realm' implicitly ('in a specific realm') and doesn't explain any parameters like email format requirements, username constraints, or the relationship between fields. This fails to add meaningful semantic context beyond the bare schema.

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'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'add-user-to-group' or 'list-users', which would require explicit comparison to achieve a score of 5.

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 like 'add-user-to-group' or 'delete-user'. It mentions 'in a specific realm' which implies a context but doesn't specify prerequisites, exclusions, or when-not-to-use scenarios.

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

Deploy Server

Other Tools