Delete User Metadata


Deletes a custom usermeta key from a user entirely, given their user ID and the meta_key. Protected keys (capabilities, role level, session tokens) are refused.

Property Value
Ability slug mosmcp/delete-user-metadata
Wire tool name mosmcp__delete-user-metadata
Category Users & Roles (mosmcp-users)
Plan Free

 

Required access

Requirement Value
Capability edit_users
Minimum default role Administrator
Annotations readOnly: false · destructive: true · idempotent: true · openWorld: false

 

Input schema

Field Type Required Default Description
id integer (min 1) Yes — The user ID to update (required).
meta_key string Yes — The meta key to delete (required). Protected keys are refused.

 

Output schema

Field Type Required
id integer Yes
meta_key string Yes
deleted boolean Yes

 

Example

Sample prompt
Remove the 'membership_tier' field from user #42.

Example request (json)

{
  "jsonrpc": "2.0",
  "id": 177,
  "method": "tools/call",
  "params": {
    "name": "mosmcp__delete-user-metadata",
    "arguments": {
      "input": {
        "id": 42,
        "meta_key": "membership_tier"
      }
    }
  }
}

Example response (json)

{
  "jsonrpc": "2.0",
  "id": 177,
  "result": {
    "isError": false,
    "structuredContent": {
      "id": 42,
      "meta_key": "membership_tier",
      "deleted": true
    }
  }
}

 

Edge cases / errors

  • Protected meta_key (capabilities, user level, session tokens and similar) → mosmcp_forbidden_meta_key, nothing deleted.
  • Deletes every value stored under the key; a key that didn't exist still returns deleted true.
  • No user with that id → mosmcp_user_not_found; no edit rights over that user → mosmcp_cannot_edit.

 


<< Previous Next >>
Delete User Get Editable Roles

For more information about the Secure MCP Server for WordPress plugin, explore the following resources:

Product Overview | Pricing | Try for Free | Documentation

If you have any questions regarding plugin configuration, pricing plans or licensing, please contact us or mail us at aisupport@xecurify.com.