update_group
Modify an existing ServiceNow group's details including name, description, manager, and active status using its group ID.
Instructions
Update an existing group in ServiceNow
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": {
"group_id": "<group_id>"
},
"name": "update_group"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group_id | Yes | Group ID or sys_id to update | |
| name | No | Name of the group | |
| description | No | Description of the group | |
| manager | No | Manager of the group (sys_id or username) | |
| parent | No | Parent group (sys_id or name) | |
| type | No | Type of the group | |
| No | Email address for the group | ||
| active | No | Whether the group is active |
Implementation Reference
- The core handler function implementing the 'update_group' tool. It constructs a PATCH request to the ServiceNow sys_user_group table API endpoint to update group details based on provided parameters.
def update_group( config: ServerConfig, auth_manager: AuthManager, params: UpdateGroupParams, ) -> GroupResponse: """ Update an existing group in ServiceNow. Args: config: Server configuration. auth_manager: Authentication manager. params: Parameters for updating the group. Returns: Response with the updated group details. """ api_url = f"{config.api_url}/table/sys_user_group/{params.group_id}" # Build request data data = {} if params.name: data["name"] = params.name if params.description: data["description"] = params.description if params.manager: data["manager"] = params.manager if params.parent: data["parent"] = params.parent if params.type: data["type"] = params.type if params.email: data["email"] = params.email if params.active is not None: data["active"] = str(params.active).lower() # Make request try: response = requests.patch( api_url, json=data, headers=auth_manager.get_headers(), timeout=config.timeout, ) response.raise_for_status() result = response.json().get("result", {}) return GroupResponse( success=True, message="Group updated successfully", group_id=result.get("sys_id"), group_name=result.get("name"), ) except requests.RequestException as e: logger.error(f"Failed to update group: {e}") return GroupResponse( success=False, message=f"Failed to update group: {str(e)}", ) - Pydantic model defining the input parameters for the update_group tool, including group_id (required) and optional fields like name, description, etc.
class UpdateGroupParams(BaseModel): """Parameters for updating a group.""" group_id: str = Field(..., description="Group ID or sys_id to update") name: Optional[str] = Field(None, description="Name of the group") description: Optional[str] = Field(None, description="Description of the group") manager: Optional[str] = Field(None, description="Manager of the group (sys_id or username)") parent: Optional[str] = Field(None, description="Parent group (sys_id or name)") type: Optional[str] = Field(None, description="Type of the group") email: Optional[str] = Field(None, description="Email address for the group") active: Optional[bool] = Field(None, description="Whether the group is active") - src/servicenow_mcp/utils/tool_utils.py:808-814 (registration)Registration of the 'update_group' tool in the central tool definitions dictionary used by the MCP server. Maps the tool name to its handler function, input schema, return type hint, description, and serialization method.
"update_group": ( update_group_tool, UpdateGroupParams, Dict[str, Any], # Expects dict "Update an existing group in ServiceNow", "raw_dict", ), - src/servicenow_mcp/tools/__init__.py:67-73 (registration)Import statement in tools/__init__.py that exposes the update_group function for use across the module.
from servicenow_mcp.tools.user_tools import ( create_user, update_user, get_user, list_users, create_group, update_group,