Skip to main content
Glama
JLKmach

ServiceNow MCP Server

by JLKmach

add_group_members

Add users to an existing ServiceNow group by specifying group ID and member identifiers to manage access permissions and team assignments.

Instructions

Add members to an existing group in ServiceNow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
group_idYesGroup ID or sys_id
membersYesList of user sys_ids or usernames to add as members

Implementation Reference

  • The main handler function that implements the add_group_members tool logic. It adds users to a group by creating sys_user_grmember records, resolving usernames to sys_ids using get_user.
    def add_group_members(
        config: ServerConfig,
        auth_manager: AuthManager,
        params: AddGroupMembersParams,
    ) -> GroupResponse:
        """
        Add members to a group in ServiceNow.
    
        Args:
            config: Server configuration.
            auth_manager: Authentication manager.
            params: Parameters for adding members to the group.
    
        Returns:
            Response with the result of the operation.
        """
        api_url = f"{config.api_url}/table/sys_user_grmember"
    
        success = True
        failed_members = []
    
        for member in params.members:
            # Get user ID if username is provided
            user_id = member
            if not member.startswith("sys_id:"):
                user = get_user(config, auth_manager, GetUserParams(user_name=member))
                if not user.get("success"):
                    user = get_user(config, auth_manager, GetUserParams(email=member))
    
                if user.get("success"):
                    user_id = user.get("user", {}).get("sys_id")
                else:
                    success = False
                    failed_members.append(member)
                    continue
    
            # Create group membership
            data = {
                "group": params.group_id,
                "user": user_id,
            }
    
            try:
                response = requests.post(
                    api_url,
                    json=data,
                    headers=auth_manager.get_headers(),
                    timeout=config.timeout,
                )
                response.raise_for_status()
            except requests.RequestException as e:
                logger.error(f"Failed to add member '{member}' to group: {e}")
                success = False
                failed_members.append(member)
    
        if failed_members:
            message = f"Some members could not be added to the group: {', '.join(failed_members)}"
        else:
            message = "All members added to the group successfully"
    
        return GroupResponse(
            success=success,
            message=message,
            group_id=params.group_id,
        )
  • Pydantic model defining the input parameters for the add_group_members tool: group_id and list of members.
    class AddGroupMembersParams(BaseModel):
        """Parameters for adding members to a group."""
    
        group_id: str = Field(..., description="Group ID or sys_id")
        members: List[str] = Field(
            ..., description="List of user sys_ids or usernames to add as members"
        )
  • Registration of the 'add_group_members' tool in the central tool_definitions dictionary, mapping name to (function, params model, return type, description, serialization).
    "add_group_members": (
        add_group_members_tool,
        AddGroupMembersParams,
        Dict[str, Any],  # Expects dict
        "Add members to an existing group in ServiceNow",
        "raw_dict",
    ),
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Add members' implies a write/mutation operation, it doesn't describe permissions required, whether the operation is idempotent, what happens if members already exist in the group, error conditions, or response format. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose without unnecessary words. It's appropriately sized for a tool with two well-documented parameters and gets straight to the point with zero wasted text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens on success/failure, return values, error handling, or behavioral constraints. The agent lacks crucial information about how this tool behaves in practice, making it incomplete for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters clearly documented in the schema (group_id as 'Group ID or sys_id', members as 'List of user sys_ids or usernames'). The description adds no additional parameter semantics beyond what's already in the schema, so the baseline score of 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Add members') and target resource ('to an existing group in ServiceNow'), providing a specific verb+resource combination. It distinguishes from sibling 'create_group' (which creates new groups) but doesn't explicitly differentiate from 'remove_group_members' or other member management tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance about when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., group must exist), when not to use it, or how it differs from sibling 'remove_group_members' or other member management approaches. The agent must infer usage from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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