Skip to main content
Glama
vparlapalli490

ServiceNow MCP Server

list_groups

Retrieve groups from ServiceNow with filtering options for active status, type, and search terms. Supports pagination with limit and offset parameters.

Instructions

List groups from ServiceNow with optional filtering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of groups to return
offsetNoOffset for pagination
activeNoFilter by active status
queryNoCase-insensitive search term that matches against group name or description fields. Uses ServiceNow's LIKE operator for partial matching.
typeNoFilter by group type

Implementation Reference

  • The handler function that implements the list_groups tool. It queries the ServiceNow sys_user_group table using the provided parameters for filtering, pagination, and search.
    def list_groups(
        config: ServerConfig,
        auth_manager: AuthManager,
        params: ListGroupsParams,
    ) -> dict:
        """
        List groups from ServiceNow.
    
        Args:
            config: Server configuration.
            auth_manager: Authentication manager.
            params: Parameters for listing groups.
    
        Returns:
            Dictionary containing list of groups.
        """
        api_url = f"{config.api_url}/table/sys_user_group"
        query_params = {
            "sysparm_limit": str(params.limit),
            "sysparm_offset": str(params.offset),
            "sysparm_display_value": "true",
        }
    
        # Build query
        query_parts = []
        if params.active is not None:
            query_parts.append(f"active={str(params.active).lower()}")
        if params.type:
            query_parts.append(f"type={params.type}")
        if params.query:
            query_parts.append(f"^nameLIKE{params.query}^ORdescriptionLIKE{params.query}")
    
        if query_parts:
            query_params["sysparm_query"] = "^".join(query_parts)
    
        # Make request
        try:
            response = requests.get(
                api_url,
                params=query_params,
                headers=auth_manager.get_headers(),
                timeout=config.timeout,
            )
            response.raise_for_status()
    
            result = response.json().get("result", [])
    
            return {
                "success": True,
                "message": f"Found {len(result)} groups",
                "groups": result,
                "count": len(result),
            }
    
        except requests.RequestException as e:
            logger.error(f"Failed to list groups: {e}")
            return {"success": False, "message": f"Failed to list groups: {str(e)}"}
  • Pydantic BaseModel defining the input parameters for the list_groups tool, including pagination, filters for active status, type, and query.
    class ListGroupsParams(BaseModel):
        """Parameters for listing groups."""
    
        limit: int = Field(10, description="Maximum number of groups to return")
        offset: int = Field(0, description="Offset for pagination")
        active: Optional[bool] = Field(None, description="Filter by active status")
        query: Optional[str] = Field(
            None,
            description="Case-insensitive search term that matches against group name or description fields. Uses ServiceNow's LIKE operator for partial matching.",
        )
        type: Optional[str] = Field(None, description="Filter by group type")
  • Registration of the list_groups tool in the central tool_definitions dictionary used by the MCP server. Includes the imported handler, schema, return type hint, description, and serialization method.
    "list_groups": (
        list_groups_tool,
        ListGroupsParams,
        Dict[str, Any],  # Expects dict
        "List groups from ServiceNow with optional filtering",
        "raw_dict",
    ),
  • The list_groups tool is exported via __all__ in the tools package __init__.py for easy imports.
    "list_groups",
  • Import alias of the list_groups function as list_groups_tool for use in tool registration.
    list_groups as list_groups_tool,
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It mentions 'optional filtering' but doesn't describe pagination behavior (implied by limit/offset), rate limits, authentication needs, or what the output looks like. For a list operation with 5 parameters, 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 front-loads the core purpose. There's no wasted language or redundancy, making it easy to parse while conveying essential information about the tool's function.

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

Completeness3/5

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

Given the tool's moderate complexity (5 parameters, no output schema, no annotations), the description is minimally adequate. It states what the tool does but lacks behavioral details, usage context, and output information that would help an agent use it effectively. The high schema coverage partially compensates for description gaps.

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%, providing good documentation for all parameters. The description adds minimal value beyond the schema by mentioning 'optional filtering' but doesn't explain parameter interactions or provide additional context. This meets the baseline for high schema coverage.

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 verb ('List') and resource ('groups from ServiceNow') with scope ('with optional filtering'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_users' or 'list_workflows' beyond the resource type, which prevents a perfect score.

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 on when to use this tool versus alternatives. With many sibling list tools available (e.g., list_users, list_workflows), there's no indication of context-specific usage, prerequisites, or comparisons. This leaves the agent without direction for tool selection.

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/vparlapalli490/MCP'

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