Skip to main content
Glama
JLKmach

ServiceNow MCP Server

by JLKmach

update_catalog_item

Modify service catalog item details including name, description, category, price, and availability to maintain accurate service offerings.

Instructions

Update a service catalog item.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
item_idYes
nameNo
short_descriptionNo
descriptionNo
categoryNo
priceNo
activeNo
orderNo

Implementation Reference

  • The core handler function that executes the tool logic by building a PATCH request to update the ServiceNow catalog item (sc_cat_item table) with the provided fields.
    def update_catalog_item(
        config: ServerConfig, auth_manager: AuthManager, params: UpdateCatalogItemParams
    ) -> Dict:
        """
        Update a catalog item.
    
        Args:
            config: The server configuration
            auth_manager: The authentication manager
            params: The parameters for updating the catalog item
    
        Returns:
            A dictionary containing the result of the update operation
        """
        logger.info(f"Updating catalog item: {params.item_id}")
        
        try:
            # Build the request body with only the provided parameters
            body = {}
            if params.name is not None:
                body["name"] = params.name
            if params.short_description is not None:
                body["short_description"] = params.short_description
            if params.description is not None:
                body["description"] = params.description
            if params.category is not None:
                body["category"] = params.category
            if params.price is not None:
                body["price"] = params.price
            if params.active is not None:
                body["active"] = str(params.active).lower()
            if params.order is not None:
                body["order"] = str(params.order)
            
            # Make the API request
            url = f"{config.instance_url}/api/now/table/sc_cat_item/{params.item_id}"
            headers = auth_manager.get_headers()
            headers["Content-Type"] = "application/json"
            
            response = requests.patch(url, headers=headers, json=body)
            response.raise_for_status()
            
            return {
                "success": True,
                "message": "Catalog item updated successfully",
                "data": response.json()["result"],
            }
        
        except Exception as e:
            logger.error(f"Error updating catalog item: {e}")
            return {
                "success": False,
                "message": f"Error updating catalog item: {str(e)}",
                "data": None,
            }
  • Pydantic model defining the input parameters for the update_catalog_item tool, including the required item_id and optional fields to update.
    class UpdateCatalogItemParams(BaseModel):
        """Parameters for updating a catalog item."""
    
        item_id: str
        name: Optional[str] = None
        short_description: Optional[str] = None
        description: Optional[str] = None
        category: Optional[str] = None
        price: Optional[str] = None
        active: Optional[bool] = None
        order: Optional[int] = None
  • Registration of the update_catalog_item tool in the central tool_definitions dictionary, mapping the name to its implementation function, params model, return type, description, and serialization hint.
    "update_catalog_item": (
        update_catalog_item_tool,
        UpdateCatalogItemParams,
        str,  # Expects JSON string
        "Update a service catalog item.",
        "json",  # Tool returns Pydantic model
    ),

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