Skip to main content
Glama

wp_create_user

Add new users to a WordPress site by specifying username, email, password, and optional roles for access management.

Instructions

Creates a new user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoThe ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured.
usernameYesThe username for the new user.
emailYesThe email address for the new user.
passwordYesThe password for the new user.
rolesNoAn array of roles to assign to the user.

Implementation Reference

  • The core handler function for the 'wp_create_user' tool. It extracts parameters, calls WordPressClient.createUser(), handles the response with a success message, and propagates errors.
    public async handleCreateUser(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> { const createParams = params as unknown as CreateUserRequest; try { const user = await client.createUser(createParams); return `✅ User "${user.name}" created successfully with ID: ${user.id}.`; } catch (_error) { throw new Error(`Failed to create user: ${getErrorMessage(_error)}`); } }
  • The tool registration within UserTools.getTools(). Defines the tool name, description, input schema (parameters), and binds the handler function for MCP tool system integration.
    { name: "wp_create_user", description: "Creates a new user.", parameters: [ { name: "username", type: "string", required: true, description: "The username for the new user.", }, { name: "email", type: "string", required: true, description: "The email address for the new user.", }, { name: "password", type: "string", required: true, description: "The password for the new user.", }, { name: "roles", type: "array", items: { type: "string" }, description: "An array of roles to assign to the user.", }, ], handler: this.handleCreateUser.bind(this), },

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/docdyhr/mcp-wordpress'

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