Skip to main content
Glama

create_user

Add new users to the Kapiti platform by providing email, name, password, and role assignments for account management.

Instructions

Create a new user in the current account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
claimsNoUser roles/claims (string or array of strings)
emailYesUser email address
firstNameYesUser first name
lastNameYesUser last name
passwordNoUser password

Implementation Reference

  • Handler function that builds payload and POSTs to /tools/membership/users API to create a new user.
    async ({ email, firstName, lastName, password, claims }) => { try { // Build payload object more carefully const payload: any = { email, firstName, lastName, }; // Only add password if provided if (password) { payload.password = password; } // Only add claims if provided and convert to array format if (claims !== undefined && claims !== null) { if (typeof claims === "string") { payload.claims = [claims]; } else if (Array.isArray(claims) && claims.length > 0) { payload.claims = claims; } // If claims is an empty array or invalid, don't include it in payload } console.error("Create user payload:", JSON.stringify(payload, null, 2)); // Debug log const response: AxiosResponse<ApiResponse<User>> = await apiClient.post("/tools/membership/users", payload); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } }
  • Zod input schema defining parameters for create_user tool: email (required), firstName, lastName, optional password and claims.
    email: z.string().email().describe("User email address"), firstName: z.string().describe("User first name"), lastName: z.string().describe("User last name"), password: z.string().optional().describe("User password"), claims: z .union([z.string(), z.array(z.string())]) .optional() .describe("User roles/claims (string or array of strings)"), },
  • src/index.ts:275-339 (registration)
    MCP server registration of the create_user tool including title, description, input schema, and handler.
    server.registerTool( "create_user", { title: "Create User", description: "Create a new user in the current account", inputSchema: { email: z.string().email().describe("User email address"), firstName: z.string().describe("User first name"), lastName: z.string().describe("User last name"), password: z.string().optional().describe("User password"), claims: z .union([z.string(), z.array(z.string())]) .optional() .describe("User roles/claims (string or array of strings)"), }, }, async ({ email, firstName, lastName, password, claims }) => { try { // Build payload object more carefully const payload: any = { email, firstName, lastName, }; // Only add password if provided if (password) { payload.password = password; } // Only add claims if provided and convert to array format if (claims !== undefined && claims !== null) { if (typeof claims === "string") { payload.claims = [claims]; } else if (Array.isArray(claims) && claims.length > 0) { payload.claims = claims; } // If claims is an empty array or invalid, don't include it in payload } console.error("Create user payload:", JSON.stringify(payload, null, 2)); // Debug log const response: AxiosResponse<ApiResponse<User>> = await apiClient.post("/tools/membership/users", payload); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } } );

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/Headlesshost/mcp-server'

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