count_users
Returns the number of users in a Keycloak realm that match specified filters such as username, email, status, or creation date.
Instructions
Get the number of users in the realm matching the given criteria.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"realm": "<realm>"
},
"name": "count_users"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | No | A query to search for custom attributes, in the format 'key1:value2 key2:value2' | |
| No | Email filter | ||
| exact | No | Boolean which defines whether the params "last", "first", "email" and "username" must match exactly | |
| realm | Yes | Realm name | |
| search | No | Search string for users | |
| enabled | No | Enabled filter | |
| idpAlias | No | The alias of an Identity Provider linked to the user | |
| lastName | No | Last name filter | |
| username | No | Username filter | |
| firstName | No | First name filter | |
| idpUserId | No | The userId at an Identity Provider linked to the user | |
| createdAfter | No | Only return users created after (inclusive) the given date, in ISO-8601 format (yyyy-MM-dd) or epoch milliseconds | |
| createdBefore | No | Only return users created before (inclusive) the given date, in ISO-8601 format (yyyy-MM-dd) or epoch milliseconds | |
| emailVerified | No | Email verified filter |