Skip to main content
Glama
kapilduraphe

Okta MCP Server

create_user

Add a new user to Okta by providing first name, last name, email, and optional details like login and activation status. Simplifies user management within the Okta MCP Server.

Instructions

Create a new user in Okta

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
activateNoWhether to activate the user immediately (default: false)
emailYesUser's email address
firstNameYesUser's first name
lastNameYesUser's last name
loginNoUser's login (defaults to email if not provided)

Implementation Reference

  • Handler function that executes the create_user tool: validates input with Zod schema, creates user via Okta SDK, handles errors, and formats response.
      create_user: async (request: { parameters: unknown }) => {
        const params = userSchemas.createUser.parse(request.parameters);
    
        try {
          const oktaClient = getOktaClient();
    
          const newUser = {
            profile: {
              firstName: params.firstName,
              lastName: params.lastName,
              email: params.email,
              login: params.login || params.email,
            },
          };
    
          const user = await oktaClient.userApi.createUser({
            body: newUser,
            activate: params.activate,
          });
    
          return {
            content: [
              {
                type: "text",
                text: `User created successfully:
    ID: ${user.id}
    Login: ${user.profile?.login}
    Status: ${user.status}
    Created: ${formatDate(user.created)}`,
              },
            ],
          };
        } catch (error) {
          console.error("Error creating user:", error);
          return {
            content: [
              {
                type: "text",
                text: `Failed to create user: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
            isError: true,
          };
        }
      },
  • Zod schema for input validation of create_user parameters, used in the handler.
    createUser: z.object({
      firstName: z.string().min(1, "First name is required"),
      lastName: z.string().min(1, "Last name is required"),
      email: z.string().email("Valid email is required"),
      login: z.string().optional(),
      activate: z.boolean().optional().default(false),
    }),
  • Tool registration definition including name, description, and JSON inputSchema for the MCP tool system.
    {
      name: "create_user",
      description: "Create a new user in Okta",
      inputSchema: {
        type: "object",
        properties: {
          firstName: {
            type: "string",
            description: "User's first name",
          },
          lastName: {
            type: "string",
            description: "User's last name",
          },
          email: {
            type: "string",
            description: "User's email address",
          },
          login: {
            type: "string",
            description: "User's login (defaults to email if not provided)",
          },
          activate: {
            type: "boolean",
            description:
              "Whether to activate the user immediately (default: false)",
          },
        },
        required: ["firstName", "lastName", "email"],
      },
    },
  • Utility function to initialize and return the OktaClient instance, used by the create_user handler and other user tools.
    function getOktaClient() {
      const oktaDomain = process.env.OKTA_ORG_URL;
      const apiToken = process.env.OKTA_API_TOKEN;
    
      if (!oktaDomain) {
        throw new Error(
          "OKTA_ORG_URL environment variable is not set. Please set it to your Okta domain."
        );
      }
    
      if (!apiToken) {
        throw new Error(
          "OKTA_API_TOKEN environment variable is not set. Please generate an API token in the Okta Admin Console."
        );
      }
    
      return new OktaClient({
        orgUrl: oktaDomain,
        token: apiToken,
      });
    }
  • src/tools/index.ts:6-6 (registration)
    Aggregation of all tool registrations including create_user from userTools.
    export const TOOLS = [...userTools, ...groupTools, ...onboardingTools];
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 a new user' which implies a write operation, but doesn't cover critical aspects like required permissions, whether the user is provisioned with defaults, error handling, or what happens on success (e.g., returns a user ID). This is inadequate for a mutation tool with zero annotation coverage.

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 that states the core purpose without any wasted words. It's appropriately sized and front-loaded, making it easy for an agent 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?

Given this is a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., user object, ID, or success status), error conditions, or behavioral nuances like how 'activate' parameter affects user state, leaving significant gaps for agent usage.

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 schema description coverage is 100%, with all parameters well-documented in the schema itself. The description adds no additional parameter information beyond what's in the schema, so it meets the baseline score of 3 where the schema does the heavy lifting.

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 Okta'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'bulk_user_import' or 'run_onboarding_workflow', which might also create users in different contexts, so it doesn't reach the highest 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., admin permissions), when to choose this over 'bulk_user_import' for multiple users, or how it relates to activation/deactivation tools, leaving the agent without usage 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

Related 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/kapilduraphe/okta-mcp-server'

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