Skip to main content
Glama
JLKmach

ServiceNow MCP Server

by JLKmach

create_group

Create a new group in ServiceNow with configurable settings including name, description, manager, parent group, type, email, members, and active status.

Instructions

Create a new group in ServiceNow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the group
descriptionNoDescription of the group
managerNoManager of the group (sys_id or username)
parentNoParent group (sys_id or name)
typeNoType of the group
emailNoEmail address for the group
membersNoList of user sys_ids or usernames to add as members
activeNoWhether the group is active

Implementation Reference

  • Implements the core logic for the 'create_group' tool by posting data to ServiceNow's sys_user_group table and handling member addition.
    def create_group( config: ServerConfig, auth_manager: AuthManager, params: CreateGroupParams, ) -> GroupResponse: """ Create a new group in ServiceNow. Args: config: Server configuration. auth_manager: Authentication manager. params: Parameters for creating the group. Returns: Response with the created group details. """ api_url = f"{config.api_url}/table/sys_user_group" # Build request data data = { "name": params.name, "active": str(params.active).lower(), } 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 # Make request try: response = requests.post( api_url, json=data, headers=auth_manager.get_headers(), timeout=config.timeout, ) response.raise_for_status() result = response.json().get("result", {}) group_id = result.get("sys_id") # Add members if provided if params.members and group_id: add_group_members( config, auth_manager, AddGroupMembersParams(group_id=group_id, members=params.members), ) return GroupResponse( success=True, message="Group created successfully", group_id=group_id, group_name=result.get("name"), ) except requests.RequestException as e: logger.error(f"Failed to create group: {e}") return GroupResponse( success=False, message=f"Failed to create group: {str(e)}", )
  • Pydantic model defining the input parameters for the create_group tool.
    class CreateGroupParams(BaseModel): """Parameters for creating a group.""" name: str = Field(..., 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") members: Optional[List[str]] = Field( None, description="List of user sys_ids or usernames to add as members" ) active: Optional[bool] = Field(True, description="Whether the group is active")
  • Registers the 'create_group' tool in the central tool definitions dictionary, mapping name to function, params schema, return type, description, and serialization method.
    "create_group": ( create_group_tool, CreateGroupParams, Dict[str, Any], # Expects dict "Create a new group in ServiceNow", "raw_dict", ),
  • Exports the create_group function from user_tools.py for use across the tools module.
    from servicenow_mcp.tools.user_tools import ( create_user, update_user, get_user, list_users, create_group,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JLKmach/servicenow-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server