Skip to main content
Glama
echelon-ai-labs

ServiceNow MCP Server

move_catalog_items

Transfer catalog items to a new category using specified item IDs and target category ID. Simplifies organization and management within ServiceNow.

Instructions

Move catalog items to a different category.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • The main handler function that implements the move_catalog_items tool logic. It iterates over the provided item_ids, sends PATCH requests to update the 'category' field to the target_category_id for each sc_cat_item in ServiceNow API, handles partial successes and failures, and returns a CatalogResponse.
    def move_catalog_items(
        config: ServerConfig,
        auth_manager: AuthManager,
        params: MoveCatalogItemsParams,
    ) -> CatalogResponse:
        """
        Move catalog items to a different category.
    
        Args:
            config: Server configuration
            auth_manager: Authentication manager
            params: Parameters for moving catalog items
    
        Returns:
            Response containing the result of the operation
        """
        logger.info(f"Moving {len(params.item_ids)} catalog items to category: {params.target_category_id}")
        
        # Build the API URL
        url = f"{config.instance_url}/api/now/table/sc_cat_item"
        
        # Make the API request for each item
        headers = auth_manager.get_headers()
        headers["Accept"] = "application/json"
        headers["Content-Type"] = "application/json"
        
        success_count = 0
        failed_items = []
        
        try:
            for item_id in params.item_ids:
                item_url = f"{url}/{item_id}"
                body = {
                    "category": params.target_category_id
                }
                
                try:
                    response = requests.patch(item_url, headers=headers, json=body)
                    response.raise_for_status()
                    success_count += 1
                except requests.exceptions.RequestException as e:
                    logger.error(f"Error moving catalog item {item_id}: {str(e)}")
                    failed_items.append({"item_id": item_id, "error": str(e)})
            
            # Prepare the response
            if success_count == len(params.item_ids):
                return CatalogResponse(
                    success=True,
                    message=f"Successfully moved {success_count} catalog items to category {params.target_category_id}",
                    data={"moved_items_count": success_count},
                )
            elif success_count > 0:
                return CatalogResponse(
                    success=True,
                    message=f"Partially moved catalog items. {success_count} succeeded, {len(failed_items)} failed.",
                    data={
                        "moved_items_count": success_count,
                        "failed_items": failed_items,
                    },
                )
            else:
                return CatalogResponse(
                    success=False,
                    message="Failed to move any catalog items",
                    data={"failed_items": failed_items},
                )
        
        except Exception as e:
            logger.error(f"Error moving catalog items: {str(e)}")
            return CatalogResponse(
                success=False,
                message=f"Error moving catalog items: {str(e)}",
                data=None,
            ) 
  • Pydantic BaseModel defining the input schema for the move_catalog_items tool, requiring a list of item_ids and the target_category_id.
    class MoveCatalogItemsParams(BaseModel):
        """Parameters for moving catalog items between categories."""
        
        item_ids: List[str] = Field(..., description="List of catalog item IDs to move")
        target_category_id: str = Field(..., description="Target category ID to move items to")
  • Entry in the tool_definitions dictionary that registers the move_catalog_items tool with its handler (aliased as move_catalog_items_tool), schema (MoveCatalogItemsParams), description, and serialization details for the MCP server.
    "move_catalog_items": (
        move_catalog_items_tool,
        MoveCatalogItemsParams,
        str,  # Expects JSON string
        "Move catalog items to a different category.",
        "json_dict",  # Tool returns Pydantic model
    ),
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. It implies a mutation ('Move'), suggesting potential side effects, but doesn't disclose behavioral traits such as permissions required, whether the move is atomic or reversible, error handling for invalid IDs, or impact on related data (e.g., references to moved items). This leaves significant gaps for a tool that modifies data.

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, clear sentence with zero wasted words. It front-loads the core action ('Move catalog items') and specifies the destination efficiently. Every word earns its place, making it easy to parse quickly.

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?

Given the tool's complexity (a mutation with no annotations, 0% schema description coverage, and no output schema), the description is incomplete. It doesn't explain what 'move' entails (e.g., does it remove from the original category?), potential side effects, error conditions, or return values. For a tool that alters data, more behavioral and contextual information is needed.

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?

The description mentions 'catalog items' and 'different category', which aligns with the parameters 'item_ids' and 'target_category_id' in the schema. However, schema description coverage is 0%, so the schema provides no parameter descriptions. The description adds some semantic context (e.g., items are moved to a category) but lacks details on ID formats, constraints, or examples. Baseline 3 is appropriate as it partially compensates for the schema gap.

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 ('Move') and resource ('catalog items'), specifying the destination ('to a different category'). It distinguishes from sibling tools like 'update_catalog_item' or 'create_catalog_category' by focusing on relocation rather than modification or creation. However, it doesn't explicitly differentiate from potential similar tools like 'reorder_workflow_activities' in terms of scope.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites (e.g., existing items/categories), exclusions (e.g., cannot move to non-existent categories), or comparisons with siblings like 'update_catalog_item' for changing other properties. It only states the basic action without context.

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