Skip to main content
Glama

Create a user

wp_create_user

Create a new WordPress user account with a specified role and return the user ID plus a generated password if none is supplied. Duplicate logins or emails are refused.

Instructions

Create a new user account with a role. Returns created, id and generated_password (the password made up when none was given, shown only in this answer; null otherwise). A login or email already in use is refused by WordPress, so a repeated call creates no second account. Needs create_users; naming a role needs promote_users, and the role has to be one the account may assign (editable_roles; an unknown role is refused): on multisite only a super admin gives administrator, and an account that is neither a single-site administrator nor a super admin cannot give a role with capabilities it lacks itself. Without a role the user becomes a subscriber. Existing accounts change with wp_update_user. No undo point is recorded.

Input Schema

NameRequiredDescriptionDefault
roleNoRole slug, e.g. editor. Default "subscriber".
emailYesEmail address; an invalid one is refused.
passwordNoPassword. Omitted: a 20-character password is generated and returned once as generated_password.
usernameYesLogin name; WordPress strips characters it does not allow in usernames.
last_nameNoOptional last name.
first_nameNoOptional first name.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.10.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only give readOnlyHint=false and destructiveHint=false; the description goes far beyond by disclosing return fields (created, id, generated_password), the one-time visibility of the generated password, the role-escalation rules on multisite, the default subscriber role, and that no undo point is recorded. That last point is exactly the kind of missing-safety context the annotations cannot convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and return values are front-loaded and every clause carries information, but the permission chain is delivered as one long semicolon-and-parenthesis run that is harder to parse than it needs to be. Dense yet not padded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a six-parameter mutation tool with no output schema, the description covers the inputs' consequences, the returned fields, permission prerequisites, and the absence of an undo path (with wp_undo/wp_undo_list as siblings). Nothing an agent needs to call this safely is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3, but the description adds semantics the schema cannot: the permission gate attached to role selection and the privilege rules governing which role may be assigned. It does not add format detail for username/email, but the added role rules are substantively useful.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and resource ("Create a new user account with a role") and explicitly routes existing accounts to wp_update_user, so the agent can separate it from that sibling without reading either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

States when to use it, the alternative for the other case ("Existing accounts change with wp_update_user"), the required capability (create_users), and the extra capability needed to name a role (promote_users). It also covers the when-not edges: duplicate login/email refused, unknown role refused, multisite administrator restrictions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools