Skip to main content
Glama

create-user

Create a new user in a Descope project by specifying login identifiers, contact details, roles, and tenant associations for authentication management.

Instructions

Create a new user in Descope project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
loginIdYesPrimary login identifier for the user
additionalLoginIdsNoAdditional login identifiers
emailNoUser's email address
verifiedEmailNoWhether the email is pre-verified
phoneNoUser's phone number in E.164 format
verifiedPhoneNoWhether the phone is pre-verified
displayNameNoUser's display name
givenNameNoUser's given/first name
middleNameNoUser's middle name
familyNameNoUser's family/last name
pictureNoURL to user's profile picture
rolesNoGlobal role names to assign to the user
userTenantsNoTenant associations with specific roles
ssoAppIdsNoSSO application IDs to associate
customAttributesNoCustom attributes for the user

Implementation Reference

  • Handler function that executes the create-user tool by calling descope.management.user.create with the provided loginId and options.
    async ({ loginId, ...options }) => { try { const user = await descope.management.user.create(loginId, options); return { content: [ { type: "text", text: `Successfully created user:\n\n${JSON.stringify(user.data, null, 2)}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error creating user: ${error}`, }, ], }; } },
  • Zod schema defining the input parameters for the create-user tool.
    { loginId: z.string() .describe("Primary login identifier for the user"), additionalLoginIds: z.array(z.string()).optional() .describe("Additional login identifiers"), email: z.string().email().optional() .describe("User's email address"), verifiedEmail: z.boolean().optional() .describe("Whether the email is pre-verified"), phone: z.string().optional() .describe("User's phone number in E.164 format"), verifiedPhone: z.boolean().optional() .describe("Whether the phone is pre-verified"), displayName: z.string().optional() .describe("User's display name"), givenName: z.string().optional() .describe("User's given/first name"), middleName: z.string().optional() .describe("User's middle name"), familyName: z.string().optional() .describe("User's family/last name"), picture: z.string().url().optional() .describe("URL to user's profile picture"), roles: z.array(z.string()).optional() .describe("Global role names to assign to the user"), userTenants: z.array(z.object({ tenantId: z.string(), roleNames: z.array(z.string()), })).optional() .describe("Tenant associations with specific roles"), ssoAppIds: z.array(z.string()).optional() .describe("SSO application IDs to associate"), customAttributes: z.record(z.any()).optional() .describe("Custom attributes for the user"), },
  • src/descope.ts:170-231 (registration)
    Registration of the create-user tool using server.tool(), including name, description, schema, and handler.
    server.tool( "create-user", "Create a new user in Descope project", { loginId: z.string() .describe("Primary login identifier for the user"), additionalLoginIds: z.array(z.string()).optional() .describe("Additional login identifiers"), email: z.string().email().optional() .describe("User's email address"), verifiedEmail: z.boolean().optional() .describe("Whether the email is pre-verified"), phone: z.string().optional() .describe("User's phone number in E.164 format"), verifiedPhone: z.boolean().optional() .describe("Whether the phone is pre-verified"), displayName: z.string().optional() .describe("User's display name"), givenName: z.string().optional() .describe("User's given/first name"), middleName: z.string().optional() .describe("User's middle name"), familyName: z.string().optional() .describe("User's family/last name"), picture: z.string().url().optional() .describe("URL to user's profile picture"), roles: z.array(z.string()).optional() .describe("Global role names to assign to the user"), userTenants: z.array(z.object({ tenantId: z.string(), roleNames: z.array(z.string()), })).optional() .describe("Tenant associations with specific roles"), ssoAppIds: z.array(z.string()).optional() .describe("SSO application IDs to associate"), customAttributes: z.record(z.any()).optional() .describe("Custom attributes for the user"), }, async ({ loginId, ...options }) => { try { const user = await descope.management.user.create(loginId, options); return { content: [ { type: "text", text: `Successfully created user:\n\n${JSON.stringify(user.data, null, 2)}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error creating user: ${error}`, }, ], }; } }, );

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/descope-sample-apps/descope-mcp-server'

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