Get User's Post Count


Returns how many posts a user has authored, given their user ID and an optional post_type (default "post"). Read-only. For the actual list of posts use mosmcp/list-user-authored-posts.

Property Value
Ability slug mosmcp/get-user-post-count
Wire tool name mosmcp__get-user-post-count
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
id integer (min 1) Yes — The user ID to look up (required).
post_type string post The post type to count. Defaults to "post".

 

Output schema

Field Type Required
id integer Yes
post_type string Yes
count integer Yes

 

Example

Sample prompt
How many posts has user #42 written?

Example request (json)

{
  "jsonrpc": "2.0",
  "id": 188,
  "method": "tools/call",
  "params": {
    "name": "mosmcp__get-user-post-count",
    "arguments": {
      "input": {
        "id": 42
      }
    }
  }
}

Example response (json)

{
  "jsonrpc": "2.0",
  "id": 188,
  "result": {
    "isError": false,
    "structuredContent": {
      "id": 42,
      "post_type": "post",
      "count": 37
    }
  }
}

 

Edge cases / errors

  • No user with that id → mosmcp_user_not_found error.
  • post_type omitted → "post"; an unknown post type returns count 0 rather than an error.
  • Counts published posts (WordPress's count_user_posts), not drafts.

 


<< Previous Next >>
Get User's Email Address Get User's 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.