Skip to main content
Glama

Set user meta

wp_update_user_meta
Destructive

Create or overwrite a WordPress user meta value, replacing all stored values for the key, with protected keys and permissions enforced; returns update status, user ID and key.

Instructions

Create or overwrite one user meta value (all stored values of the key are replaced). Refused: keys starting with "_", role and capability keys of any site (…capabilities, …user_level), session_tokens, default_password_nonce, use_ssl and credential-like keys; role and password are changed by wp_update_user. Needs edit_users, the right to edit this user and to edit this key; an unknown user is a not-found error. WordPress strips backslashes from the value. Returns updated, user_id and key. No undo point is recorded; wp_get_user_meta reads the value.

Input Schema

NameRequiredDescriptionDefault
keyYesMeta key; stored lower-cased with characters other than a-z, 0-9, "_" and "-" removed (sanitize_key).
valueNoScalar or array of scalars (arrays may nest); an array is stored serialized. Omitted: an empty string.
user_idYesUser id, as wp_list_users returns it.

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?

The description goes well beyond the annotations (destructiveHint=true, readOnlyHint=false): it discloses that all stored values of the key are replaced, that no undo point is recorded, that backslashes are stripped, what the return payload contains, and the full refusal list. This gives the agent concrete consequences the annotations alone cannot express.

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?

The core destructive behavior is front-loaded in the first sentence, followed by refusals, auth, edge behaviors and return value. It is dense and semicolon-heavy but nearly every clause carries operational information.

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 mutation tool with no output schema, the description covers preconditions, refused inputs, side effects (no undo), value normalization, and the return shape (updated, user_id, key). Nothing an agent needs to call it correctly appears to be 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 the schema already documents key sanitization, array serialization and the empty-string default. The description adds value semantics not in the schema (WordPress strips backslashes), which raises it above the baseline 3.

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?

The description states a specific verb (create or overwrite) and resource (one user meta value), and clarifies the destructive semantics of replacement. It also names the sibling it is not (role and password are changed by wp_update_user), so an agent can distinguish it from wp_update_user and the post/term meta variants.

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?

Explicit exclusions are given (refused key prefixes, capability/user_level keys, session_tokens, credential-like keys), with the correct alternative named for role/password changes. It also states the permission gate (edit_users) and the failure mode for an unknown user.

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