Skip to main content
Glama
kapilduraphe

Okta MCP Server

provision_applications

Assign application access to multiple users by specifying user IDs and application IDs. Integrates with Okta MCP Server for streamlined user management and provisioning.

Instructions

Provision application access for multiple users

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
applicationIdsYesApplication IDs to provision
userIdsYesList of user IDs to provision access for

Implementation Reference

  • The main handler function for the 'provision_applications' tool. It validates input with Zod, uses Okta SDK to assign users to applications, tracks success/failure per user and per app, and returns a formatted summary.
      provision_applications: async (request: { parameters: unknown }) => {
        const { userIds, applicationIds } = 
          onboardingSchemas.provisionApplications.parse(request.parameters);
        
        try {
          const oktaClient = getOktaClient();
          
          const results = {
            success: [] as any[],
            failed: [] as any[]
          };
          
          // Process each user
          for (const userId of userIds) {
            try {
              // Get user details
              const user = await oktaClient.userApi.getUser({ userId });
              
              if (!user || !user.profile) {
                results.failed.push({
                  userId,
                  reason: 'User not found or profile unavailable'
                });
                continue;
              }
              
              const userResults = {
                userId,
                email: user.profile.email,
                applications: [] as any[]
              };
              
              let hasFailure = false;
              
              // Assign each application
              for (const appId of applicationIds) {
                try {
                  // Assign user to application
                  await oktaClient.applicationApi.assignUserToApplication({
                    appId,
                    appUser: {
                      id: userId
                    }
                  });
                  
                  userResults.applications.push({
                    appId,
                    status: 'assigned'
                  });
                } catch (error) {
                  hasFailure = true;
                  userResults.applications.push({
                    appId,
                    status: 'failed',
                    reason: error instanceof Error ? error.message : String(error)
                  });
                }
              }
              
              if (hasFailure) {
                results.failed.push(userResults);
              } else {
                results.success.push(userResults);
              }
            } catch (error) {
              results.failed.push({
                userId,
                reason: error instanceof Error ? error.message : String(error),
                applications: []
              });
            }
          }
          
          // Format response
          const summary = `Processed application provisioning for ${userIds.length} users across ${applicationIds.length} applications:
    - Successful provisioning: ${results.success.length} users
    - Failed provisioning: ${results.failed.length} users
    
    ${results.success.length > 0 ? `• Successfully provisioned users:
    ${results.success.map((user, i) => 
      `${i+1}. ${user.email || user.userId} (provisioned ${user.applications.length} applications)`
    ).join('\n')}` : ''}
    
    ${results.failed.length > 0 ? `• Failed provisioning:
    ${results.failed.map((user, i) => {
      const failedApps = user.applications.filter((app: { status: string; }) => app.status === 'failed').length;
      return `${i+1}. ${user.email || user.userId} - ${user.reason || `${failedApps} applications failed`}`;
    }).join('\n')}` : ''}`;
          
          return {
            content: [{ type: 'text', text: summary }],
            data: results
          };
        } catch (error) {
          console.error("Error during application provisioning:", error);
          return {
            content: [
              {
                type: "text",
                text: `Failed to provision applications: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
            isError: true,
          };
        }
      },
  • The tool registration in the onboardingTools array, including name, description, and JSON inputSchema for the MCP tool.
    {
      name: "provision_applications",
      description: "Provision application access for multiple users",
      inputSchema: {
        type: "object",
        properties: {
          userIds: {
            type: "array",
            items: { type: "string" },
            description: "List of user IDs to provision access for"
          },
          applicationIds: {
            type: "array",
            items: { type: "string" },
            description: "Application IDs to provision"
          }
        },
        required: ["userIds", "applicationIds"]
      },
    },
  • Zod schema for input validation of provision_applications parameters, used in the handler.
    provisionApplications: z.object({
      userIds: z.array(z.string().min(1, "User ID is required")),
      applicationIds: z.array(z.string().min(1, "Application ID is required")),
    }),
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('provision') but doesn't clarify whether this is a read-only or mutative operation, what permissions are required, whether it's idempotent, or what happens on failure. For a tool that likely modifies access rights, this lack of behavioral context is a significant gap.

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 communicates the core purpose without unnecessary words. It's appropriately sized for a tool with two parameters and no complex behavioral nuances to explain. Every word earns its place.

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 tool that likely performs user access provisioning (a potentially significant mutation), the description is incomplete. With no annotations, no output schema, and minimal behavioral context, the agent lacks crucial information about what the tool actually does, what it returns, and what side effects it might have. The description should provide more context about this operation's nature and consequences.

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?

Schema description coverage is 100%, with both parameters clearly documented in the schema. The description adds no additional parameter information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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 ('provision application access') and target ('for multiple users'), which is a specific verb+resource combination. It distinguishes from siblings like 'activate_user' or 'assign_users_to_groups' by focusing on application access provisioning rather than user status or group assignments. However, it doesn't explicitly differentiate from potential similar tools not in the sibling list.

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, exclusions, or compare with siblings like 'run_onboarding_workflow' which might overlap. The agent must infer usage from the tool name alone, which is insufficient for optimal selection.

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