Get User Metadata


Returns non-sensitive usermeta key/value pairs for a user, given their user ID. Pass meta_key to fetch a single key, or omit it to return all. Internal keys (session tokens, capabilities, and user level) are always refused/excluded. Read-only.

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

 

Required access

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

 

Input schema

Field Type Required Default Description
id integer (min 1) Yes — The user ID to look up (required).
meta_key string — Optional. A single meta key to fetch. If omitted, all non-sensitive metadata is returned.

 

Output schema

Field Type Required
id integer Yes
meta object Yes

 

Example

Sample prompt
Show me the custom profile data stored for user #42.

Example request (json)

{
  "jsonrpc": "2.0",
  "id": 183,
  "method": "tools/call",
  "params": {
    "name": "mosmcp__get-user-metadata",
    "arguments": {
      "input": {
        "id": 42,
        "meta_key": "billing_phone"
      }
    }
  }
}

Example response (json)

{
  "jsonrpc": "2.0",
  "id": 183,
  "result": {
    "isError": false,
    "structuredContent": {
      "id": 42,
      "meta": {
        "billing_phone": [
          "+1 555 0100"
        ]
      }
    }
  }
}

 

Edge cases / errors

  • Protected meta_key (any capabilities, user_level or *session_tokens key, plus primary_blog, use_ssl, default_password_nag and similar) → mosmcp_forbidden_meta_key error.
  • meta_key omitted → all metadata returned with protected keys stripped; passing an empty string instead is refused as protected.
  • Values come back as arrays (a key can hold several values); a key that doesn't exist returns an empty array, not an error.
  • No user with that id → mosmcp_user_not_found error.

 


<< Previous Next >>
Get User by Username Get User Registration Date

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.