Skip to main content
Glama
echelon-ai-labs

ServiceNow MCP Server

list_catalog_items

Retrieve service catalog items from a ServiceNow instance based on filters like category, activity status, and search queries. Supports pagination for managing large datasets.

Instructions

List service catalog items.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • The core handler function that executes the list_catalog_items tool. It queries the ServiceNow sc_cat_item table via REST API, applies filters based on params, formats the results, and returns a structured dictionary.
    def list_catalog_items(
        config: ServerConfig,
        auth_manager: AuthManager,
        params: ListCatalogItemsParams,
    ) -> Dict[str, Any]:
        """
        List service catalog items from ServiceNow.
    
        Args:
            config: Server configuration
            auth_manager: Authentication manager
            params: Parameters for listing catalog items
    
        Returns:
            Dictionary containing catalog items and metadata
        """
        logger.info("Listing service catalog items")
        
        # Build the API URL
        url = f"{config.instance_url}/api/now/table/sc_cat_item"
        
        # Prepare query parameters
        query_params = {
            "sysparm_limit": params.limit,
            "sysparm_offset": params.offset,
            "sysparm_display_value": "true",
            "sysparm_exclude_reference_link": "true",
        }
        
        # Add filters
        filters = []
        if params.active:
            filters.append("active=true")
        if params.category:
            filters.append(f"category={params.category}")
        if params.query:
            filters.append(f"short_descriptionLIKE{params.query}^ORnameLIKE{params.query}")
        
        if filters:
            query_params["sysparm_query"] = "^".join(filters)
        
        # Make the API request
        headers = auth_manager.get_headers()
        headers["Accept"] = "application/json"
        
        try:
            response = requests.get(url, headers=headers, params=query_params)
            response.raise_for_status()
            
            # Process the response
            result = response.json()
            items = result.get("result", [])
            
            # Format the response
            formatted_items = []
            for item in items:
                formatted_items.append({
                    "sys_id": item.get("sys_id", ""),
                    "name": item.get("name", ""),
                    "short_description": item.get("short_description", ""),
                    "category": item.get("category", ""),
                    "price": item.get("price", ""),
                    "picture": item.get("picture", ""),
                    "active": item.get("active", ""),
                    "order": item.get("order", ""),
                })
            
            return {
                "success": True,
                "message": f"Retrieved {len(formatted_items)} catalog items",
                "items": formatted_items,
                "total": len(formatted_items),
                "limit": params.limit,
                "offset": params.offset,
            }
        
        except requests.exceptions.RequestException as e:
            logger.error(f"Error listing catalog items: {str(e)}")
            return {
                "success": False,
                "message": f"Error listing catalog items: {str(e)}",
                "items": [],
                "total": 0,
                "limit": params.limit,
                "offset": params.offset,
            }
  • Pydantic BaseModel defining the input schema/parameters for the list_catalog_items tool, including pagination, filtering, and search options.
    class ListCatalogItemsParams(BaseModel):
        """Parameters for listing service catalog items."""
        
        limit: int = Field(10, description="Maximum number of catalog items to return")
        offset: int = Field(0, description="Offset for pagination")
        category: Optional[str] = Field(None, description="Filter by category")
        query: Optional[str] = Field(None, description="Search query for catalog items")
        active: bool = Field(True, description="Whether to only return active catalog items")
  • MCP tool registration entry in get_tool_definitions() dictionary. Maps the tool name to its implementation function (alias), input schema model, return type hint, description, and serialization method used by the MCP server.
    "list_catalog_items": (
        list_catalog_items_tool,
        ListCatalogItemsParams,
        str,  # Expects JSON string
        "List service catalog items.",
        "json",  # Tool returns list/dict
    ),
  • Import alias for the list_catalog_items implementation function, used in the MCP tool definitions.
    from servicenow_mcp.tools.catalog_tools import (
        list_catalog_items as list_catalog_items_tool,
    )
  • Import of the list_catalog_items function into the tools package namespace, making it available for MCP registration.
    from servicenow_mcp.tools.catalog_tools import (
        create_catalog_category,
        get_catalog_item,
        list_catalog_categories,
        list_catalog_items,
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'List' implies a read-only operation, but the description doesn't clarify if it's safe, if it requires authentication, what the output format is, or if there are rate limits. For a tool with zero annotation coverage, this is a significant gap in behavioral context.

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 with no wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word earns its place by conveying essential information without redundancy.

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 complexity (a list operation with filtering and pagination), no annotations, and no output schema, the description is minimally complete. It states what the tool does but lacks details on behavior, output, or error handling. The schema provides good parameter documentation, but overall context is limited, making it adequate but with clear gaps for effective tool use.

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

Parameters4/5

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

The input schema has 1 parameter ('params') with 0% description coverage, but this parameter is a nested object containing 5 well-documented sub-parameters (active, category, limit, offset, query) with clear descriptions in the schema. Since the description doesn't add any parameter information beyond the schema, and the schema effectively covers all parameters, the baseline is high. However, the description could have added context like default behaviors or usage examples.

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

Purpose3/5

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

The description 'List service catalog items' clearly states the verb (list) and resource (service catalog items), making the basic purpose understandable. However, it doesn't differentiate from sibling tools like 'list_catalog_categories' or 'get_catalog_item', nor does it specify scope (e.g., all items vs. filtered). This makes it adequate but vague regarding exact function.

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. It doesn't mention sibling tools like 'get_catalog_item' for single items or 'list_catalog_categories' for categories, nor does it specify prerequisites or contexts for use. This leaves the agent without explicit usage instructions.

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

Related 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/echelon-ai-labs/servicenow-mcp'

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