Skip to main content
Glama
Octodet

Advanced Keycloak MCP server

by Octodet

reset-user-password

Reset or set password for a user in a Keycloak realm, with optional temporary flag.

Instructions

Reset or set a new password for a user in a specific realm

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
realmYesRealm name
userIdYesUser ID
passwordYesNew password
temporaryNoWhether the password is temporary

Implementation Reference

  • The actual handler method `resetUserPassword` on the KeycloakService class. It authenticates, sets the realm, and calls the Keycloak admin client's `users.resetPassword` API with the password credential.
    async resetUserPassword(params: {
      realm: string;
      userId: string;
      password: string;
      temporary?: boolean;
    }) {
      await this.authenticate();
      this.client.setConfig({ realmName: params.realm });
    
      await this.client.users.resetPassword({
        id: params.userId,
        realm: params.realm,
        credential: {
          type: "password",
          value: params.password,
          temporary: params.temporary || false,
        },
      });
    }
  • Zod validation schema `ResetUserPasswordSchema` defining the input: realm (string), userId (string), password (string), and temporary (boolean with default false).
    const ResetUserPasswordSchema = z.object({
      realm: z.string(),
      userId: z.string(),
      password: z.string(),
      temporary: z.boolean().default(false),
    });
  • src/index.ts:424-437 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining the tool name 'reset-user-password', description, and input schema (realm, userId, password, temporary).
    {
      name: "reset-user-password",
      description: "Reset or set a new password for a user in a specific realm",
      inputSchema: {
        type: "object",
        properties: {
          realm: { type: "string", description: "Realm name" },
          userId: { type: "string", description: "User ID" },
          password: { type: "string", description: "New password" },
          temporary: { type: "boolean", description: "Whether the password is temporary", default: false },
        },
        required: ["realm", "userId", "password"],
      },
    },
  • The case branch in CallToolRequestSchema handler: parses args with ResetUserPasswordSchema, calls keycloakService.resetUserPassword(), and returns a success message indicating whether the password was set as temporary.
    case "reset-user-password": {
      const params = ResetUserPasswordSchema.parse(args);
      await keycloakService.resetUserPassword(params);
      return {
        content: [
          {
            type: "text",
            text: `Password ${params.temporary ? "temporarily " : ""}reset successfully for user ${params.userId} in realm ${params.realm}${
              params.temporary ? ". User will be required to change password on next login." : "."
            }`,
          },
        ],
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states the basic action without revealing traits like required permissions, side effects (e.g., email notification), or behavior for temporary passwords.

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

Conciseness4/5

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

The description is a single, clear sentence with no wasted words. It is appropriately front-loaded, but could be slightly more comprehensive without losing conciseness.

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 absence of annotations and output schema, the description is too minimal for a mutation tool with 4 parameters. It does not explain return values, error conditions, or how the 'temporary' parameter affects behavior, leaving gaps for the agent.

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

Parameters3/5

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

The input schema has 100% description coverage, so the description adds no additional meaning beyond what is already in the schema. It does not clarify constraints like password complexity or implications of the 'temporary' flag.

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

Purpose5/5

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

The description clearly states the action (reset/set password) and the resource (user in a specific realm). It is distinct from sibling tools like create-user or update-user-roles, which perform different operations.

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

Usage Guidelines3/5

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

The description implies when to use the tool (to change a password) but does not explicitly state when not to use it or mention alternatives. It lacks guidance on prerequisites or conditions, but the purpose is reasonably clear from context.

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/Octodet/keycloak-mcp'

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