List Users


Returns a paginated list of WordPress users on this site, optionally filtered by role slug. Read-only. To search by keyword use mosmcp/search-users; for a single user use mosmcp/get-user-by-id, mosmcp/get-user-by-username, or mosmcp/get-user-by-email.

Property Value
Ability slug mosmcp/list-users
Wire tool name mosmcp__list-users
Category Users & Roles (mosmcp-users)
Plan Free

 

Required access

Requirement Value
Capability list_users
Minimum default role Administrator (Shop manager too when WooCommerce is active)
Annotations readOnly: true · destructive: false · idempotent: true · openWorld: false

 

Input schema

Field Type Required Default Description
page integer (min 1) 1 Page number to return, starting at 1.
per_page integer (1–100) 20 Users per page (max 100).
role string — Optional role slug to filter by (e.g. "editor"). See mosmcp/list-roles for valid slugs.

 

Output schema

Field Type Required
users object[] Yes
users[].id integer
users[].username string
users[].display_name string
users[].email string
users[].roles string[]
users[].registered string
total integer Yes
page integer Yes
per_page integer Yes

 

Example

Sample prompt
Show me all the editors on my site.

Example request (json)

{
  "jsonrpc": "2.0",
  "id": 192,
  "method": "tools/call",
  "params": {
    "name": "mosmcp__list-users",
    "arguments": {
      "input": {
        "role": "editor",
        "per_page": 20
      }
    }
  }
}

Example response (json)

{
  "jsonrpc": "2.0",
  "id": 192,
  "result": {
    "isError": false,
    "structuredContent": {
      "users": [
        {
          "id": 42,
          "username": "janedoe",
          "display_name": "Jane Doe",
          "email": "jane@example.com",
          "roles": [
            "editor"
          ],
          "registered": "2025-03-14 09:21:07"
        }
      ],
      "total": 1,
      "page": 1,
      "per_page": 20
    }
  }
}

 

Edge cases / errors

  • per_page above 100 → clamped to 100; page below 1 → treated as page 1.
  • role that matches no role (or has no members) → empty users array with total 0, not an error.
  • role is normalised with sanitize_key (lowercased, special characters stripped), so "Editor" matches "editor".
  • total is the full match count across all pages, so it can be larger than the number of users returned.

 


<< Previous Next >>
List Roles Remove Role from User

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.