list_users
Retrieve and filter user accounts from ServiceNow with options for pagination, status, department, and search queries.
Instructions
List users in ServiceNow
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_users"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of users to return | |
| offset | No | Offset for pagination | |
| active | No | Filter by active status | |
| department | No | Filter by department | |
| query | No | Case-insensitive search term that matches against name, username, or email fields. Uses ServiceNow's LIKE operator for partial matching. |
Implementation Reference
- Pydantic BaseModel defining the input schema/parameters for the list_users tool, including pagination (limit, offset) and filters (active, department, query).
class ListUsersParams(BaseModel): """Parameters for listing users.""" limit: int = Field(10, description="Maximum number of users to return") offset: int = Field(0, description="Offset for pagination") active: Optional[bool] = Field(None, description="Filter by active status") department: Optional[str] = Field(None, description="Filter by department") query: Optional[str] = Field( None, description="Case-insensitive search term that matches against name, username, or email fields. Uses ServiceNow's LIKE operator for partial matching.", ) - src/servicenow_mcp/utils/tool_utils.py:748-754 (registration)Registration of the 'list_users' tool in the central tool_definitions dictionary used by the MCP server. Maps the tool name to its handler function (list_users_tool), input schema (ListUsersParams), return type, description, and serialization method.
"list_users": ( list_users_tool, ListUsersParams, Dict[str, Any], # Expects dict "List users in ServiceNow", "raw_dict", ), - src/servicenow_mcp/tools/__init__.py:67-77 (registration)Import and re-export of the list_users function from user_tools.py in the tools package __init__.py, making it available for import from the tools module.
from servicenow_mcp.tools.user_tools import ( create_user, update_user, get_user, list_users, create_group, update_group, add_group_members, remove_group_members, list_groups, )